|
3 | 3 | Scatter plot on polar axis
|
4 | 4 | ==========================
|
5 | 5 |
|
6 |
| -Demo of scatter plot on a polar axis. |
7 |
| -
|
8 | 6 | Size increases radially in this example and color increases with angle
|
9 | 7 | (just to verify the symbols are being scattered correctly).
|
10 | 8 | """
|
|
22 | 20 | area = 200 * r**2
|
23 | 21 | colors = theta
|
24 | 22 |
|
25 |
| -ax = plt.subplot(111, projection='polar') |
| 23 | +fig = plt.figure() |
| 24 | +ax = fig.add_subplot(111, projection='polar') |
26 | 25 | c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)
|
27 | 26 |
|
| 27 | +############################################################################### |
| 28 | +# Scatter plot on polar axis, with offset origin |
| 29 | +# ---------------------------------------------- |
| 30 | +# |
| 31 | +# The main difference with the previous plot is the configuration of the origin |
| 32 | +# radius, producing an annulus. Additionally, the theta zero location is set to |
| 33 | +# rotate the plot. |
| 34 | + |
| 35 | +fig = plt.figure() |
| 36 | +ax = fig.add_subplot(111, polar=True) |
| 37 | +c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75) |
| 38 | + |
| 39 | +ax.set_rorigin(-2.5) |
| 40 | +ax.set_theta_zero_location('W', offset=10) |
| 41 | + |
| 42 | +############################################################################### |
| 43 | +# Scatter plot on polar axis confined to a sector |
| 44 | +# ----------------------------------------------- |
| 45 | +# |
| 46 | +# The main difference with the previous plots is the configuration of the |
| 47 | +# theta start and end limits, producing a sector instead of a full circle. |
| 48 | + |
| 49 | +fig = plt.figure() |
| 50 | +ax = fig.add_subplot(111, polar=True) |
| 51 | +c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75) |
| 52 | + |
| 53 | +ax.set_thetamin(45) |
| 54 | +ax.set_thetamax(135) |
| 55 | + |
28 | 56 | plt.show()
|
0 commit comments