8000 Merge pull request #14677 from anntzer/set_ticks-inverted · matplotlib/matplotlib@21a55d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 21a55d3

Browse files
authored
Merge pull request #14677 from anntzer/set_ticks-inverted
FIX: Don't misclip axis when calling set_ticks on inverted axes.
2 parents 0d486c2 + 557375f commit 21a55d3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/matplotlib/axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,7 @@ def setter(self, vmin, vmax, ignore=False):
19061906
setter(self, min(vmin, vmax, oldmin), max(vmin, vmax, oldmax),
19071907
ignore=True)
19081908
else:
1909-
setter(self, max(vmin, vmax, oldmax), min(vmin, vmax, oldmin),
1909+
setter(self, max(vmin, vmax, oldmin), min(vmin, vmax, oldmax),
19101910
ignore=True)
19111911
self.stale = True
19121912

lib/matplotlib/tests/test_axes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6432,3 +6432,10 @@ def test_bar_errbar_zorder():
64326432
assert capline.zorder > bar.zorder
64336433
for barlinecol in barlinecols:
64346434
assert barlinecol.zorder > bar.zorder
6435+
6436+
6437+
def test_set_ticks_inverted():
6438+
fig, ax = plt.subplots()
6439+
ax.invert_xaxis()
6440+
ax.set_xticks([.3, .7])
6441+
assert ax.get_xlim() == (1, 0)

0 commit comments

Comments
 (0)
0