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

Method nonsingular

lib/matplotlib/dates.py:1121–1137  ·  view source on GitHub ↗

Given the proposed upper and lower extent, adjust the range if it is too close to being singular (i.e. a range of ~0).

(self, vmin, vmax)

Source from the content-addressed store, hash-verified

1119 return 1
1120
1121 def nonsingular(self, vmin, vmax):
1122 """
1123 Given the proposed upper and lower extent, adjust the range
1124 if it is too close to being singular (i.e. a range of ~0).
1125 """
1126 if not np.isfinite(vmin) or not np.isfinite(vmax):
1127 # Except if there is no data, then use 1970 as default.
1128 return (date2num(datetime.date(1970, 1, 1)),
1129 date2num(datetime.date(1970, 1, 2)))
1130 if vmax < vmin:
1131 vmin, vmax = vmax, vmin
1132 unit = self._get_unit()
1133 interval = self._get_interval()
1134 if abs(vmax - vmin) < 1e-6:
1135 vmin -= 2 * unit * interval
1136 vmax += 2 * unit * interval
1137 return vmin, vmax
1138
1139
1140class RRuleLocator(DateLocator):

Callers 1

test_DateLocatorFunction · 0.95

Calls 3

_get_unitMethod · 0.95
_get_intervalMethod · 0.95
date2numFunction · 0.85

Tested by 1

test_DateLocatorFunction · 0.76