Viewing Polar Axes

Views also support viewing polar axes.

plot 06 polar views
 8 import numpy as np
 9 import matplotlib.pyplot as plt
10 from matplotview import view
11
12 # Create the data...
13 r = np.arange(0, 2, 0.01)
14 theta = 2 * np.pi * r
15
16 fig, (ax, ax2) = plt.subplots(1, 2, subplot_kw=dict(projection='polar'))
17
18 ax.plot(theta, r)
19 ax.set_rmax(2)
20 ax.set_rticks([0.5, 1, 1.5, 2])  # Less radial ticks
21 ax.set_rlabel_position(-22.5)  # Move radial labels away from plotted line
22 # Include a grid
23 ax.grid(True)
24
25 # ax2 is now zoomed in on ax.
26 view(ax2, ax)
27
28 fig.tight_layout()
29
30 fig.show()

Total running time of the script: (0 minutes 0.519 seconds)

Gallery generated by Sphinx-Gallery