File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
doc/api/next_api_changes/deprecations Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change
1
+ ``epoch2num `` and ``num2epoch `` are deprecated
2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3
+ These methods convert from unix timestamps to matplotlib floats, but are not
4
+ useed internally to matplotlib, and should not be needed by endusers.
5
+ To convert a unix timestamp to datetime, simply use
6
+ `datetime.datetime.utcfromtimestamp `, or to use numpy datetime64
7
+ ``dt = np.datetim64(e*1e6, 'us') ``.
Original file line number Diff line number Diff line change @@ -1729,6 +1729,8 @@ def _get_interval(self):
1729
1729
return self ._interval
1730
1730
1731
1731
1732
+ @_api .deprecated ("3.5" ,
1733
+ alternative = "mdates.date2num(datetime.utcfromtimestamp(e))" )
1732
1734
def epoch2num (e ):
1733
1735
"""
1734
1736
Convert UNIX time to days since Matplotlib epoch.
@@ -1750,6 +1752,7 @@ def epoch2num(e):
1750
1752
return (dt + np .asarray (e )) / SEC_PER_DAY
1751
1753
1752
1754
1755
+ @_api .deprecated ("3.5" , alternative = "mdates.num2date(e).timestamp()" )
1753
1756
def num2epoch (d ):
1754
1757
"""
1755
1758
Convert days since Matplotlib epoch to UNIX time.
You can’t perform that action at this time.
0 commit comments