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

Skip to content

Commit ec99332

Browse files
authored
Merge pull request #14228 from phobson/axis-docstring
DOC: fix parameters line in Axes.axis docstring
2 parents afc21ae + fb47087 commit ec99332

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ def axis(self, *args, **kwargs):
16281628
16291629
Parameters
16301630
----------
1631-
xmin, ymin, xmax, ymax : float, optional
1631+
xmin, xmax, ymin, ymax : float, optional
16321632
The axis limits to be set. Either none or all of the limits must
16331633
be given. This can also be achieved using ::
16341634

lib/matplotlib/tests/test_axes.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6449,6 +6449,22 @@ def test_axis_bool_arguments(fig_test, fig_ref):
64496449
fig_ref.add_subplot(212).axis("on")
64506450

64516451

6452+
def test_axis_extent_arg():
6453+
fig, ax = plt.subplots()
6454+
xmin = 5
6455+
xmax = 10
6456+
ymin = 15
6457+
ymax = 20
6458+
extent = ax.axis([xmin, xmax, ymin, ymax])
6459+
6460+
# test that the docstring is correct
6461+
assert tuple(extent) == (xmin, xmax, ymin, ymax)
6462+
6463+
# test that limits were set per the docstring
6464+
assert (xmin, xmax) == ax.get_xlim()
6465+
assert (ymin, ymax) == ax.get_ylim()
6466+
6467+
64526468
def test_datetime_masked():
64536469
# make sure that all-masked data falls back to the viewlim
64546470
# set in convert.axisinfo....

0 commit comments

Comments
 (0)