Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3a5683b

Browse filesBrowse files
committed
FIX: translate timedeltas in _to_ordinalf
1 parent 63fe909 commit 3a5683b
Copy full SHA for 3a5683b

File tree

1 file changed

+5
-0
lines changed
Filter options

1 file changed

+5
-0
lines changed

‎lib/matplotlib/dates.py

Copy file name to clipboardExpand all lines: lib/matplotlib/dates.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ def _to_ordinalf(dt):
222222
dt = dt.astimezone(UTC)
223223
tzi = UTC
224224

225+
if isinstance(dt, datetime.timedelta):
226+
base = dt / datetime.timedelta(days=1)
227+
return base
228+
225229
base = float(dt.toordinal())
226230

227231
# If it's sufficiently datetime-like, it will have a `date()` method
@@ -405,6 +409,7 @@ def date2num(d):
405409
Gregorian calendar is assumed; this is not universal practice.
406410
For details see the module docstring.
407411
"""
412+
408413
if hasattr(d, "values"):
409414
# this unpacks pandas series or dataframes...
410415
d = d.values

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.