MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / nonsingular

Method nonsingular

lib/matplotlib/ticker.py:2991–3025  ·  view source on GitHub ↗
(self, vmin, vmax)

Source from the content-addressed store, hash-verified

2989 return super().tick_values(vmin, vmax)
2990
2991 def nonsingular(self, vmin, vmax):
2992 standard_minpos = 1e-7
2993 initial_range = (standard_minpos, 1 - standard_minpos)
2994 if vmin > vmax:
2995 vmin, vmax = vmax, vmin
2996 if not np.isfinite(vmin) or not np.isfinite(vmax):
2997 vmin, vmax = initial_range # Initial range, no data plotted yet.
2998 elif vmax <= 0 or vmin >= 1:
2999 # vmax <= 0 occurs when all values are negative
3000 # vmin >= 1 occurs when all values are greater than one
3001 _api.warn_external(
3002 "Data has no values between 0 and 1, and therefore cannot be "
3003 "logit-scaled."
3004 )
3005 vmin, vmax = initial_range
3006 else:
3007 minpos = (
3008 self.axis.get_minpos()
3009 if self.axis is not None
3010 else standard_minpos
3011 )
3012 if not np.isfinite(minpos):
3013 minpos = standard_minpos # This should never take effect.
3014 if vmin <= 0:
3015 vmin = minpos
3016 # NOTE: for vmax, we should query a property similar to get_minpos,
3017 # but related to the maximal, less-than-one data point.
3018 # Unfortunately, Bbox._minpos is defined very deep in the BBox and
3019 # updated with data, so for now we use 1 - minpos as a substitute.
3020 if vmax >= 1:
3021 vmax = 1 - minpos
3022 if vmin == vmax:
3023 vmin, vmax = 0.1 * vmin, 1 - 0.1 * vmin
3024
3025 return vmin, vmax
3026
3027
3028class AutoLocator(MaxNLocator):

Callers 3

tick_valuesMethod · 0.95
test_nonsingular_okMethod · 0.95
test_nonsingular_nokMethod · 0.95

Calls 1

get_minposMethod · 0.45

Tested by 2

test_nonsingular_okMethod · 0.76
test_nonsingular_nokMethod · 0.76