Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7731471

Browse files
committed
ENH: Allow setting angle limits on PolarAxes.
Setting angular limits allows one to create "wedges" instead of a full circle or annulus.
1 parent 720a16d commit 7731471

File tree

8 files changed

+9099
-964
lines changed

8 files changed

+9099
-964
lines changed

lib/matplotlib/projections/polar.py

Lines changed: 273 additions & 78 deletions
Large diffs are not rendered by default.
Binary file not shown.

lib/matplotlib/tests/baseline_images/test_axes/polar_theta_position.svg

Lines changed: 864 additions & 886 deletions
Loading
Binary file not shown.

lib/matplotlib/tests/baseline_images/test_axes/polar_theta_wedge.svg

Lines changed: 7939 additions & 0 deletions
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,29 @@ def test_polar_rlabel_position():
467467
ax.set_rlabel_position(315)
468468

469469

470+
@image_comparison(baseline_images=['polar_theta_wedge'])
471+
def test_polar_theta_limits():
472+
r = np.arange(0, 3.0, 0.01)
473+
theta = 2*np.pi*r
474+
475+
theta_mins = np.arange(15.0, 361.0, 90.0)
476+
theta_maxs = np.arange(50.0, 361.0, 90.0)
477+
478+
fig, axes = plt.subplots(len(theta_mins), len(theta_maxs),
479+
subplot_kw={'polar': True},
480+
figsize=(16, 12))
481+
482+
for i, start in enumerate(theta_mins):
483+
for j, end in enumerate(theta_maxs):
484+
ax = axes[i, j]
485+
if start < end:
486+
ax.plot(theta, r)
487+
ax.set_thetamin(start)
488+
ax.set_thetamax(end)
489+
else:
490+
ax.set_visible(False)
491+
492+
470493
@image_comparison(baseline_images=['axvspan_epoch'])
471494
def test_axvspan_epoch():
472495
from datetime import datetime

0 commit comments

Comments
 (0)