Skip to content

Lim parameter naming #11293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/scales/log_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
ax4.set(title='Errorbars go negative')
ax4.errorbar(x, y, xerr=0.1 * x, yerr=5.0 + 0.75 * y)
# ylim must be set after errorbar to allow errorbar to autoscale limits
ax4.set_ylim(ymin=0.1)
ax4.set_ylim(bottom=0.1)

fig.tight_layout()
plt.show()
4 changes: 2 additions & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7307,8 +7307,8 @@ def spy(self, Z, precision=0, marker=None, markersize=None,
marker=marker, markersize=markersize, **kwargs)
self.add_line(marks)
nr, nc = Z.shape
self.set_xlim(xmin=-0.5, xmax=nc - 0.5)
self.set_ylim(ymin=nr - 0.5, ymax=-0.5)
self.set_xlim(-0.5, nc - 0.5)
self.set_ylim(nr - 0.5, -0.5)
self.set_aspect(aspect)
ret = marks
self.title.set_y(1.05)
Expand Down
31 changes: 16 additions & 15 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1297,20 +1297,21 @@ def xlim(*args, **kwargs):

Call signatures::

xmin, xmax = xlim() # return the current xlim
xlim((xmin, xmax)) # set the xlim to xmin, xmax
xlim(xmin, xmax) # set the xlim to xmin, xmax
left, right = xlim() # return the current xlim
xlim((left, right)) # set the xlim to left, right
xlim(left, right) # set the xlim to left, right

If you do not specify args, you can pass *xmin* or *xmax* as kwargs, i.e.::
If you do not specify args, you can pass *left* or *right* as kwargs,
i.e.::

xlim(xmax=3) # adjust the max leaving min unchanged
xlim(xmin=1) # adjust the min leaving max unchanged
xlim(right=3) # adjust the right leaving left unchanged
xlim(left=1) # adjust the left leaving right unchanged

Setting limits turns autoscaling off for the x-axis.

Returns
-------
xmin, xmax
left, right
A tuple of the new x-axis limits.

Notes
Expand All @@ -1333,21 +1334,21 @@ def ylim(*args, **kwargs):

Call signatures::

ymin, ymax = ylim() # return the current ylim
ylim((ymin, ymax)) # set the ylim to ymin, ymax
ylim(ymin, ymax) # set the ylim to ymin, ymax
bottom, top = ylim() # return the current ylim
ylim((bottom, top)) # set the ylim to bottom, top
ylim(bottom, top) # set the ylim to bottom, top

If you do not specify args, you can alternatively pass *ymin* or *ymax* as
kwargs, i.e.::
If you do not specify args, you can alternatively pass *bottom* or
*top* as kwargs, i.e.::

ylim(ymax=3) # adjust the max leaving min unchanged
ylim(ymin=1) # adjust the min leaving max unchanged
ylim(top=3) # adjust the top leaving bottom unchanged
ylim(bottom=1) # adjust the top leaving bottom unchanged

Setting limits turns autoscaling off for the y-axis.

Returns
-------
ymin, ymax
bottom, top
A tuple of the new y-axis limits.

Notes
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ def test_hist_step_filled():
for kg, _type, ax in zip(kwargs, types, axes):
ax.hist(x, n_bins, histtype=_type, stacked=True, **kg)
ax.set_title('%s/%s' % (kg, _type))
ax.set_ylim(ymin=-50)
ax.set_ylim(bottom=-50)

patches = axes[0].patches
assert all(p.get_facecolor() == p.get_edgecolor() for p in patches)
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_simplification.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_overflow():

fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_xlim(xmin=2, xmax=6)
ax.set_xlim(2, 6)


@image_comparison(baseline_images=['clipping_diamond'], remove_text=True)
Expand All @@ -43,8 +43,8 @@ def test_diamond():

fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_xlim(xmin=-0.6, xmax=0.6)
ax.set_ylim(ymin=-0.6, ymax=0.6)
ax.set_xlim(-0.6, 0.6)
ax.set_ylim(-0.6, 0.6)


def test_noise():
Expand Down