Skip to content

Commit 391bb24

Browse files
authored
Merge pull request #17435 from tacaswell/auto-backport-of-pr-17422-on-v3.2.x
Backport PR #17422: Unstale viewlims before draw()ing polar axes.
2 parents 479ad1a + 83f963a commit 391bb24

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

examples/statistics/confidence_ellipse.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def get_correlated_dataset(n, dependency, mu, scale):
217217

218218
ax_kwargs.scatter(x, y, s=0.5)
219219
ax_kwargs.scatter(mu[0], mu[1], c='red', s=3)
220-
ax_kwargs.set_title(f'Using kwargs')
220+
ax_kwargs.set_title('Using kwargs')
221221

222222
fig.subplots_adjust(hspace=0.25)
223223
plt.show()

lib/matplotlib/projections/polar.py

+1
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

+5-1
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)