8000 doc: MicrosecondLocator: Add note on limitations and workaround · matplotlib/matplotlib@74889a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 74889a1

Browse files
committed
doc: MicrosecondLocator: Add note on limitations and workaround
1 parent 1247921 commit 74889a1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

lib/matplotlib/dates.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,23 @@ def __init__(self, bysecond=None, interval=1, tz=None):
15111511

15121512
class MicrosecondLocator(DateLocator):
15131513
"""
1514-
Make ticks on occurances of each microsecond.
1514+
Make ticks on regular intervals of one or more microsecond(s).
1515+
1516+
.. note::
1517+
1518+
Due to the floating point representation of time in days since
1519+
0001-01-01 UTC (plus 1), plotting data with microsecond time
1520+
resolution does not work with arbitrary dates.
1521+
1522+
If you want microsecond resolution time plots, we recommend
1523+
using floating point seconds or milliseconds, not datetime-like
1524+
time representation.
1525+
1526+
If you still want to use datetime.datetime() and the likes, be
1527+
sure to use very early years; year 0001 will give highest
1528+
precision. But be warned that you may still run into issues
1529+
with tick positioning and labeling. Be careful to check your
1530+
plots!
15151531
15161532
"""
15171533
def __init__(self, interval=1, tz=None):

0 commit comments

Comments
 (0)
0