From fb4708782f627021e2f48ae5ae995bf03bfdd414 Mon Sep 17 00:00:00 2001 From: Paul Hobson Date: Thu, 16 May 2019 09:55:02 -0700 Subject: [PATCH] DOC: fix parameters line in Axes.axis docstring --- lib/matplotlib/axes/_base.py | 2 +- lib/matplotlib/tests/test_axes.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 949ce6347393..93bd354cd1e6 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -1628,7 +1628,7 @@ def axis(self, *args, **kwargs): Parameters ---------- - xmin, ymin, xmax, ymax : float, optional + xmin, xmax, ymin, ymax : float, optional The axis limits to be set. Either none or all of the limits must be given. This can also be achieved using :: diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index f08f45b67e9b..cf2bf89ff68c 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -6450,6 +6450,22 @@ def test_axis_bool_arguments(fig_test, fig_ref): fig_ref.add_subplot(212).axis("on") +def test_axis_extent_arg(): + fig, ax = plt.subplots() + xmin = 5 + xmax = 10 + ymin = 15 + ymax = 20 + extent = ax.axis([xmin, xmax, ymin, ymax]) + + # test that the docstring is correct + assert tuple(extent) == (xmin, xmax, ymin, ymax) + + # test that limits were set per the docstring + assert (xmin, xmax) == ax.get_xlim() + assert (ymin, ymax) == ax.get_ylim() + + def test_datetime_masked(): # make sure that all-masked data falls back to the viewlim # set in convert.axisinfo....