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

Class AutoDateLocator

lib/matplotlib/dates.py:1216–1446  ·  view source on GitHub ↗

On autoscale, this class picks the best `DateLocator` to set the view limits and the tick locations. Attributes ---------- intervald : dict Mapping of tick frequencies to multiples allowed for that ticking. The default is :: self.intervald = {

Source from the content-addressed store, hash-verified

1214
1215
1216class AutoDateLocator(DateLocator):
1217 """
1218 On autoscale, this class picks the best `DateLocator` to set the view
1219 limits and the tick locations.
1220
1221 Attributes
1222 ----------
1223 intervald : dict
1224
1225 Mapping of tick frequencies to multiples allowed for that ticking.
1226 The default is ::
1227
1228 self.intervald = {
1229 YEARLY : [1, 2, 4, 5, 10, 20, 40, 50, 100, 200, 400, 500,
1230 1000, 2000, 4000, 5000, 10000],
1231 MONTHLY : [1, 2, 3, 4, 6],
1232 DAILY : [1, 2, 3, 7, 14, 21],
1233 HOURLY : [1, 2, 3, 4, 6, 12],
1234 MINUTELY: [1, 5, 10, 15, 30],
1235 SECONDLY: [1, 5, 10, 15, 30],
1236 MICROSECONDLY: [1, 2, 5, 10, 20, 50, 100, 200, 500,
1237 1000, 2000, 5000, 10000, 20000, 50000,
1238 100000, 200000, 500000, 1000000],
1239 }
1240
1241 where the keys are defined in `dateutil.rrule`.
1242
1243 The interval is used to specify multiples that are appropriate for
1244 the frequency of ticking. For instance, every 7 days is sensible
1245 for daily ticks, but for minutes/seconds, 15 or 30 make sense.
1246
1247 When customizing, you should only modify the values for the existing
1248 keys. You should not add or delete entries.
1249
1250 Example for forcing ticks every 3 hours::
1251
1252 locator = AutoDateLocator()
1253 locator.intervald[HOURLY] = [3] # only show every 3 hours
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

Callers 2

axisinfoMethod · 0.85
axisinfoMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…