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)
| 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 | |
| 1140 | class RRuleLocator(DateLocator): |