From fd68836998c5942ce1e27abc8ffe345d2b524bde Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 18 Feb 2019 16:24:51 -0800 Subject: [PATCH 1/2] FIX: allow bottom-only call --- lib/matplotlib/projections/polar.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index 188ffe0708f2..f42de16b00de 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -1202,9 +1202,8 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False, 'argument and kwarg "ymax"') else: top = ymax - if top is None and len(bottom) == 2: - top = bottom[1] - bottom = bottom[0] + if top is None and np.iterable(bottom): + bottom, top = bottom[0], bottom[1] return super().set_ylim(bottom=bottom, top=top, emit=emit, auto=auto) From 907067a9e260492c40f1686e0b0ecda535395258 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Mon, 18 Feb 2019 16:31:50 -0800 Subject: [PATCH 2/2] TST: add test for rlim --- lib/matplotlib/tests/test_axes.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 1a848692907e..179731c73f7d 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -794,6 +794,27 @@ def test_polar_theta_limits(): ax.yaxis.set_tick_params(label2On=True, rotation='auto') +@check_figures_equal(extensions=["png"]) +def test_polar_rlim(fig_test, fig_ref): + ax = fig_test.subplots(subplot_kw={'polar': True}) + ax.set_rlim(top=10) + ax.set_rlim(bottom=.5) + + ax = fig_ref.subplots(subplot_kw={'polar': True}) + ax.set_rmax(10.) + ax.set_rmin(.5) + + +@check_figures_equal(extensions=["png"]) +def test_polar_rlim_bottom(fig_test, fig_ref): + ax = fig_test.subplots(subplot_kw={'polar': True}) + ax.set_rlim(bottom=[.5, 10]) + + ax = fig_ref.subplots(subplot_kw={'polar': True}) + ax.set_rmax(10.) + ax.set_rmin(.5) + + @image_comparison(baseline_images=['axvspan_epoch']) def test_axvspan_epoch(): from datetime import datetime