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

Skip to content

Commit e70c6f8

Browse files
authored
Merge pull request #17422 from anntzer/polarunstale
Unstale viewlims before draw()ing polar axes.
2 parents 425f9cf + c01f9d3 commit e70c6f8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/matplotlib/projections/polar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ def get_yaxis_text2_transform(self, pad):
949949
@cbook._delete_parameter("3.3", "args")
950950
@cbook._delete_parameter("3.3", "kwargs")
951951
def draw(self, renderer, *args, **kwargs):
952+
self._unstale_viewLim()
952953
thetamin, thetamax = np.rad2deg(self._realViewLim.intervalx)
953954
if thetamin > thetamax:
954955
thetamin, thetamax = thetamax, thetamin

lib/matplotlib/tests/test_polar.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ def test_polar_invertedylim():
191191
def test_polar_invertedylim_rorigin():
192192
fig = plt.figure()
193193
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
194-
ax.set_ylim(2, 0)
194+
ax.yaxis.set_inverted(True)
195+
# Set the rlims to inverted (2, 0) without calling set_rlim, to check that
196+
# viewlims are correctly unstaled before draw()ing.
197+
ax.plot([0, 0], [0, 2], c="none")
198+
ax.margins(0)
195199
ax.set_rorigin(3)
196200

197201

0 commit comments

Comments
 (0)