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

Skip to content

Commit 404e0ff

Browse files
QuLogictacaswell
authored andcommitted
Backport PR #17422: Unstale viewlims before draw()ing polar axes.
Merge pull request #17422 from anntzer/polarunstale Unstale viewlims before draw()ing polar axes. Conflicts: lib/matplotlib/projections/polar.py - conflicts from nearyby changes to signature of draw lib/matplotlib/tests/test_polar.py - tests are still in test_axes.py on v3.2.x
1 parent 479ad1a commit 404e0ff

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
@@ -953,6 +953,7 @@ def get_yaxis_text2_transform(self, pad):
953953
return self._yaxis_text_transform + pad_shift, 'center', halign
954954

955955
def draw(self, *args, **kwargs):
956+
self._unstale_viewLim()
956957
thetamin, thetamax = np.rad2deg(self._realViewLim.intervalx)
957958
if thetamin > thetamax:
958959
thetamin, thetamax = thetamax, thetamin

lib/matplotlib/tests/test_axes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,11 @@ def test_polar_invertedylim():
750750
def test_polar_invertedylim_rorigin():
751751
fig = plt.figure()
752752
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
753-
ax.set_ylim(2, 0)
753+
ax.yaxis.set_inverted(True)
754+
# Set the rlims to inverted (2, 0) without calling set_rlim, to check that
755+
# viewlims are correctly unstaled before draw()ing.
756+
ax.plot([0, 0], [0, 2], c="none")
757+
ax.margins(0)
754758
ax.set_rorigin(3)
755759

756760

0 commit comments

Comments
 (0)