Skip to content

Commit 72d0270

Browse files
authored
Merge pull request #17677 from meeseeksmachine/auto-backport-of-pr-17664-on-v3.3.x
Backport PR #17664 on branch v3.3.x (Clarify docs of AutoDateLocator.intervald)
2 parents ee341ea + 0dc4c29 commit 72d0270

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/matplotlib/dates.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -1215,14 +1215,14 @@ class AutoDateLocator(DateLocator):
12151215
----------
12161216
intervald : dict
12171217

1218-
Mapping of tick frequencies (a constant from dateutil.rrule) to
1219-
multiples allowed for that ticking. The default looks like this::
1218+
Mapping of tick frequencies to multiples allowed for that ticking.
1219+
The default is ::
12201220

12211221
self.intervald = {
12221222
YEARLY : [1, 2, 4, 5, 10, 20, 40, 50, 100, 200, 400, 500,
12231223
1000, 2000, 4000, 5000, 10000],
12241224
MONTHLY : [1, 2, 3, 4, 6],
1225-
DAILY : [1, 2, 3, 7, 14],
1225+
DAILY : [1, 2, 3, 7, 14, 21],
12261226
HOURLY : [1, 2, 3, 4, 6, 12],
12271227
MINUTELY: [1, 5, 10, 15, 30],
12281228
SECONDLY: [1, 5, 10, 15, 30],
@@ -1231,10 +1231,16 @@ class AutoDateLocator(DateLocator):
12311231
100000, 200000, 500000, 1000000],
12321232
}
12331233

1234+
where the keys are defined in `dateutil.rrule`.
1235+
12341236
The interval is used to specify multiples that are appropriate for
12351237
the frequency of ticking. For instance, every 7 days is sensible
12361238
for daily ticks, but for minutes/seconds, 15 or 30 make sense.
1237-
You can customize this dictionary by doing::
1239+
1240+
When customizing, you should only modify the values for the existing
1241+
keys. You should not add or delete entries.
1242+
1243+
Example for forcing ticks every 3 hours::
12381244

12391245
locator = AutoDateLocator()
12401246
locator.intervald[HOURLY] = [3] # only show every 3 hours

0 commit comments

Comments
 (0)