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

Skip to content

Commit e14ee84

Browse files
committed
MNT: remove the swap_vlim dance
In #14624 we reverted changing the order of the limits to match the input order. Doing the same here for consistency. Sort the limits before comparing. We want to make sure that it works with the values reversed, but do not expect non-singular to preserve the order.
1 parent dfa8367 commit e14ee84

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def test_nonsingular_ok(self, lims):
387387
"""
388388
loc = mticker.LogitLocator()
389389
lims2 = loc.nonsingular(*lims)
390-
assert lims == lims2
390+
assert sorted(lims) == sorted(lims2)
391391

392392
@pytest.mark.parametrize("okval", acceptable_vmin_vmax)
393393
def test_nonsingular_nok(self, okval):

lib/matplotlib/ticker.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2794,9 +2794,7 @@ def ideal_ticks(x):
27942794
def nonsingular(self, vmin, vmax):
27952795
standard_minpos = 1e-7
27962796
initial_range = (standard_minpos, 1 - standard_minpos)
2797-
swap_vlims = False
27982797
if vmin > vmax:
2799-
swap_vlims = True
28002798
vmin, vmax = vmax, vmin
28012799
if not np.isfinite(vmin) or not np.isfinite(vmax):
28022800
vmin, vmax = initial_range # Initial range, no data plotted yet.
@@ -2826,8 +2824,7 @@ def nonsingular(self, vmin, vmax):
28262824
vmax = 1 - minpos
28272825
if vmin == vmax:
28282826
vmin, vmax = 0.1 * vmin, 1 - 0.1 * vmin
2829-
if swap_vlims:
2830-
vmin, vmax = vmax, vmin
2827+
28312828
return vmin, vmax
28322829

28332830

0 commit comments

Comments
 (0)