Parameters ---------- tz : str or `~datetime.tzinfo`, default: :rc:`timezone` Ticks timezone. If a string, *tz* is passed to `dateutil.tz`. minticks : int The minimum number of ticks desired; controls whether ticks occur yearly, mo
(self, tz=None, minticks=5, maxticks=None,
interval_multiples=True)
| 1254 | """ |
| 1255 | |
| 1256 | def __init__(self, tz=None, minticks=5, maxticks=None, |
| 1257 | interval_multiples=True): |
| 1258 | """ |
| 1259 | Parameters |
| 1260 | ---------- |
| 1261 | tz : str or `~datetime.tzinfo`, default: :rc:`timezone` |
| 1262 | Ticks timezone. If a string, *tz* is passed to `dateutil.tz`. |
| 1263 | minticks : int |
| 1264 | The minimum number of ticks desired; controls whether ticks occur |
| 1265 | yearly, monthly, etc. |
| 1266 | maxticks : int |
| 1267 | The maximum number of ticks desired; controls the interval between |
| 1268 | ticks (ticking every other, every 3, etc.). For fine-grained |
| 1269 | control, this can be a dictionary mapping individual rrule |
| 1270 | frequency constants (YEARLY, MONTHLY, etc.) to their own maximum |
| 1271 | number of ticks. This can be used to keep the number of ticks |
| 1272 | appropriate to the format chosen in `AutoDateFormatter`. Any |
| 1273 | frequency not specified in this dictionary is given a default |
| 1274 | value. |
| 1275 | interval_multiples : bool, default: True |
| 1276 | Whether ticks should be chosen to be multiple of the interval, |
| 1277 | locking them to 'nicer' locations. For example, this will force |
| 1278 | the ticks to be at hours 0, 6, 12, 18 when hourly ticking is done |
| 1279 | at 6 hour intervals. |
| 1280 | """ |
| 1281 | super().__init__(tz=tz) |
| 1282 | self._freq = YEARLY |
| 1283 | self._freqs = [YEARLY, MONTHLY, DAILY, HOURLY, MINUTELY, |
| 1284 | SECONDLY, MICROSECONDLY] |
| 1285 | self.minticks = minticks |
| 1286 | |
| 1287 | self.maxticks = {YEARLY: 11, MONTHLY: 12, DAILY: 11, HOURLY: 12, |
| 1288 | MINUTELY: 11, SECONDLY: 11, MICROSECONDLY: 8} |
| 1289 | if maxticks is not None: |
| 1290 | try: |
| 1291 | self.maxticks.update(maxticks) |
| 1292 | except TypeError: |
| 1293 | # Assume we were given an integer. Use this as the maximum |
| 1294 | # number of ticks for every frequency and create a |
| 1295 | # dictionary for this |
| 1296 | self.maxticks = dict.fromkeys(self._freqs, maxticks) |
| 1297 | self.interval_multiples = interval_multiples |
| 1298 | self.intervald = { |
| 1299 | YEARLY: [1, 2, 4, 5, 10, 20, 40, 50, 100, 200, 400, 500, |
| 1300 | 1000, 2000, 4000, 5000, 10000], |
| 1301 | MONTHLY: [1, 2, 3, 4, 6], |
| 1302 | DAILY: [1, 2, 3, 7, 14, 21], |
| 1303 | HOURLY: [1, 2, 3, 4, 6, 12], |
| 1304 | MINUTELY: [1, 5, 10, 15, 30], |
| 1305 | SECONDLY: [1, 5, 10, 15, 30], |
| 1306 | MICROSECONDLY: [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, |
| 1307 | 5000, 10000, 20000, 50000, 100000, 200000, 500000, |
| 1308 | 1000000], |
| 1309 | } |
| 1310 | if interval_multiples: |
| 1311 | # Swap "3" for "4" in the DAILY list; If we use 3 we get bad |
| 1312 | # tick loc for months w/ 31 days: 1, 4, ..., 28, 31, 1 |
| 1313 | # If we use 4 then we get: 1, 5, ... 25, 29, 1 |