8000 DOC: Add what's new for polar axes. · matplotlib/matplotlib@b85c48c · GitHub
[go: up one dir, main page]

Skip to content

Commit b85c48c

Browse files
committed
DOC: Add what's new for polar axes.
1 parent d549014 commit b85c48c

File tree

2 files changed

+68
-3
lines changed

2 files changed

+68
-3
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Enhancements to polar plot
2+
--------------------------
3+
4+
The polar axes transforms have been greatly re-factored to allow for more
5+
customization of view limits and tick labelling. Additional options for view
6+
limits allow for creating an annulus, a sector, or some combination of the two.
7+
8+
The :meth:`~matplotlib.axes.projections.polar.PolarAxes.set_rorigin` method may
9+
be used to provide an offset to the minimum plotting radius, producing an
10+
annulus.
11+
12+
The :meth:`~matplotlib.projections.polar.PolarAxes.set_theta_zero_location` now
13+
has an optional :code:`offset` argument. This argument may be used to further
14+
specify the zero location based on the given anchor point.
15+
16+
.. figure:: ../../gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_001.png
17+
:target: ../../gallery/pie_and_polar_charts/polar_scatter.html
18+
:align: center
19+
:scale: 50
20+
21+
Polar Offset Demo
22+
23+
The :meth:`~matplotlib.axes.projections.polar.PolarAxes.set_thetamin` and
24+
:meth:`~matplotlib.axes.projections.polar.PolarAxes.set_thetamax` methods may
25+
be used to limit the range of angles plotted, producing sectors of a circle.
26+
27+
.. figure:: ../../gallery/pie_and_polar_charts/images/sphx_glr_polar_scatter_002.png
28+
:target: ../../gallery/pie_and_polar_charts/polar_scatter.html
29+
:align: center
30+
:scale: 50
31+
32+
Polar Sector Demo
33+
34+
Previous releases allowed plots containing negative radii for which the
35+
negative values are simply used as labels, and the real radius is shifted by
36+
the configured minimum. This release also allows negative radii to be used for
37+
grids and ticks, which were previously silently ignored.

examples/pie_and_polar_charts/polar_scatter.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
Scatter plot on polar axis
44
==========================
55
6-
Demo of scatter plot on a polar axis.
7-
86
Size increases radially in this example and color increases with angle
97
(just to verify the symbols are being scattered correctly).
108
"""
@@ -22,7 +20,37 @@
2220
area = 200 * r**2
2321
colors = theta
2422

25-
ax = plt.subplot(111, projection='polar')
23+
fig = plt.figure()
24+
ax = fig.add_subplot(111, projection='polar')
2625
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)
2726

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+
2856
plt.show()

0 commit comments

Comments
 (0)
0