Skip to content

Commit 7dca1bf

Browse files
authored
Merge pull request #13465 from jklymak/fix-polar-bottom
FIX: polar set_rlim allow bottom-only call
2 parents ed1d8dd + 907067a commit 7dca1bf

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

lib/matplotlib/projections/polar.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,9 +1189,8 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
11891189
'argument and kwarg "ymax"')
11901190
else:
11911191
top = ymax
1192-
if top is None and len(bottom) == 2:
1193-
top = bottom[1]
1194-
bottom = bottom[0]
1192+
if top is None and np.iterable(bottom):
1193+
bottom, top = bottom[0], bottom[1]
11951194

11961195
return super().set_ylim(bottom=bottom, top=top, emit=emit, auto=auto)
11971196

lib/matplotlib/tests/test_axes.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,27 @@ def test_polar_theta_limits():
795795
ax.yaxis.set_tick_params(label2On=True, rotation='auto')
796796

797797

798+
@check_figures_equal(extensions=["png"])
799+
def test_polar_rlim(fig_test, fig_ref):
800+
ax = fig_test.subplots(subplot_kw={'polar': True})
801+
ax.set_rlim(top=10)
802+
ax.set_rlim(bottom=.5)
803+
804+
ax = fig_ref.subplots(subplot_kw={'polar': True})
805+
ax.set_rmax(10.)
806+
ax.set_rmin(.5)
807+
808+
809+
@check_figures_equal(extensions=["png"])
810+
def test_polar_rlim_bottom(fig_test, fig_ref):
811+
ax = fig_test.subplots(subplot_kw={'polar': True})
812+
ax.set_rlim(bottom=[.5, 10])
813+
814+
ax = fig_ref.subplots(subplot_kw={'polar': True})
815+
ax.set_rmax(10.)
816+
ax.set_rmin(.5)
817+
818+
798819
@image_comparison(baseline_images=['axvspan_epoch'])
799820
def test_axvspan_epoch():
800821
from datetime import datetime

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy