Skip to content
Closed
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 lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
else:
_tight = self._tight = bool(tight)

if self._xmargin or self._ymargin:
if (self._xmargin or self._ymargin) and not _tight:
margins = {
'top': True,
'bottom': True,
Expand Down
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ def test_autoscale_tiny_range():
ax[i].plot([0, 1], [1, 1 + y1])


@cleanup
def test_autoscale_tight():
fig, ax = plt.subplots(1, 1)
ax.plot([1, 2, 3, 4])
ax.autoscale(enable=True, axis='x', tight=False)
ax.autoscale(enable=True, axis='y', tight=True)
assert_allclose(ax.get_xlim(), (-0.15, 3.15))
assert_allclose(ax.get_ylim(), (1.0, 4.0))


@image_comparison(baseline_images=['offset_points'],
remove_text=True)
def test_basic_annotate():
Expand Down