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

Skip to content

Commit bba6db3

Browse files
authored
Merge pull request #14816 from meeseeksmachine/auto-backport-of-pr-14677-on-v3.1.x
Backport PR #14677 on branch v3.1.x (Don't misclip axis when calling set_ticks on inverted axes.)
2 parents 24517bb + 407a9fe commit bba6db3

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

lib/matplotlib/axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ def setter(self, vmin, vmax, ignore=False):
18921892
setter(self, min(vmin, vmax, oldmin), max(vmin, vmax, oldmax),
18931893
ignore=True)
18941894
else:
1895-
setter(self, max(vmin, vmax, oldmax), min(vmin, vmax, oldmin),
1895+
setter(self, max(vmin, vmax, oldmin), min(vmin, vmax, oldmax),
18961896
ignore=True)
18971897
self.stale = True
18981898

lib/matplotlib/tests/test_axes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6411,3 +6411,10 @@ def test_bar_errbar_zorder():
64116411
assert capline.zorder > bar.zorder
64126412
for barlinecol in barlinecols:
64136413
assert barlinecol.zorder > bar.zorder
6414+
6415+
6416+
def test_set_ticks_inverted():
6417+
fig, ax = plt.subplots()
6418+
ax.invert_xaxis()
6419+
ax.set_xticks([.3, .7])
6420+
assert ax.get_xlim() == (1, 0)

0 commit comments

Comments
 (0)