From c01f9d3eff9b6239446c1bb2d205eccd69054aeb Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Fri, 15 May 2020 18:59:01 +0200 Subject: [PATCH] Unstale viewlims before draw()ing polar axes. --- lib/matplotlib/projections/polar.py | 1 + lib/matplotlib/tests/test_polar.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index 902946c6b316..0649a03c8fbc 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -949,6 +949,7 @@ def get_yaxis_text2_transform(self, pad): @cbook._delete_parameter("3.3", "args") @cbook._delete_parameter("3.3", "kwargs") def draw(self, renderer, *args, **kwargs): + self._unstale_viewLim() thetamin, thetamax = np.rad2deg(self._realViewLim.intervalx) if thetamin > thetamax: thetamin, thetamax = thetamax, thetamin diff --git a/lib/matplotlib/tests/test_polar.py b/lib/matplotlib/tests/test_polar.py index 12f03fd6c6bd..100954ac32a7 100644 --- a/lib/matplotlib/tests/test_polar.py +++ b/lib/matplotlib/tests/test_polar.py @@ -191,7 +191,11 @@ def test_polar_invertedylim(): def test_polar_invertedylim_rorigin(): fig = plt.figure() ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True) - ax.set_ylim(2, 0) + ax.yaxis.set_inverted(True) + # Set the rlims to inverted (2, 0) without calling set_rlim, to check that + # viewlims are correctly unstaled before draw()ing. + ax.plot([0, 0], [0, 2], c="none") + ax.margins(0) ax.set_rorigin(3)