Skip to content

Commit 2ff5b81

Browse files
committed
Add test for polar limit changing
1 parent 46966d8 commit 2ff5b81

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lib/matplotlib/tests/test_polar.py

+24
Original file line numberDiff line numberDiff line change
@@ -454,3 +454,27 @@ def test_polar_neg_theta_lims():
454454
ax.set_thetalim(-np.pi, np.pi)
455455
labels = [l.get_text() for l in ax.xaxis.get_ticklabels()]
456456
assert labels == ['-180°', '-135°', '-90°', '-45°', '0°', '45°', '90°', '135°']
457+
458+
459+
@check_figures_equal(extensions=["png"])
460+
def test_polar_lim_draw(fig_test, fig_ref):
461+
"""
462+
Check that lines on polar axes are correctly transformed after
463+
a draw and an axes limit change.
464+
465+
"""
466+
# A quarter arc at r=5
467+
theta = np.linspace(0, np.pi/2, 90)
468+
r = np.full(90, 5)
469+
470+
ax_ref = fig_ref.add_subplot(projection='polar')
471+
ax_ref.set_ylim(0, 10)
472+
ax_ref.plot(theta, r)
473+
474+
ax_test = fig_test.add_subplot(projection='polar')
475+
ax_test.set_ylim(4, 10)
476+
477+
ax_test.plot(theta, r)
478+
fig_test.canvas.draw()
479+
480+
ax_test.set_ylim(0, 10)

0 commit comments

Comments
 (0)