Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitb50fa14

Browse files
committed
Backport PRmatplotlib#17983: FIX: undeprecate and update num2epoch/epoch2num
1 parentef7feb1 commitb50fa14

File tree

2 files changed

+9
-51
lines changed

2 files changed

+9
-51
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
Deprecations
22
------------
3+
4+
Reverted deprecation of `~.dates.num2epoch` and `~.dates.epoch2num`
5+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6+
7+
These two functions were deprecated in 3.3.0, and did not return
8+
an accurate Matplotlib datenum relative to the new Matplotlib epoch
9+
handling (`~.dates.get_epoch` and:rc:`date.epoch`). This version
10+
reverts the deprecation and fixes those functions to work with
11+
`~.dates.get_epoch`.

‎lib/matplotlib/tests/test_dates.py

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -949,57 +949,6 @@ def test_change_epoch():
949949
0.5)
950950

951951

952-
deftest_warn_notintervals():
953-
dates=np.arange('2001-01-10','2001-03-04',dtype='datetime64[D]')
954-
locator=mdates.AutoDateLocator(interval_multiples=False)
955-
locator.intervald[3]= [2]
956-
locator.create_dummy_axis()
957-
locator.set_view_interval(mdates.date2num(dates[0]),
958-
mdates.date2num(dates[-1]))
959-
withpytest.warns(UserWarning,match="AutoDateLocator was unable")asrec:
960-
locs=locator()
961-
962-
963-
deftest_change_converter():
964-
plt.rcParams['date.converter']='concise'
965-
dates=np.arange('2020-01-01','2020-05-01',dtype='datetime64[D]')
966-
fig,ax=plt.subplots()
967-
968-
ax.plot(dates,np.arange(len(dates)))
969-
fig.canvas.draw()
970-
assertax.get_xticklabels()[0].get_text()=='Jan'
971-
assertax.get_xticklabels()[1].get_text()=='15'
972-
973-
plt.rcParams['date.converter']='auto'
974-
fig,ax=plt.subplots()
975-
976-
ax.plot(dates,np.arange(len(dates)))
977-
fig.canvas.draw()
978-
assertax.get_xticklabels()[0].get_text()=='Jan 01 2020'
979-
assertax.get_xticklabels()[1].get_text()=='Jan 15 2020'
980-
withpytest.warns(UserWarning)asrec:
981-
plt.rcParams['date.converter']='boo'
982-
983-
984-
deftest_change_interval_multiples():
985-
plt.rcParams['date.interval_multiples']=False
986-
dates=np.arange('2020-01-10','2020-05-01',dtype='datetime64[D]')
987-
fig,ax=plt.subplots()
988-
989-
ax.plot(dates,np.arange(len(dates)))
990-
fig.canvas.draw()
991-
assertax.get_xticklabels()[0].get_text()=='Jan 10 2020'
992-
assertax.get_xticklabels()[1].get_text()=='Jan 24 2020'
993-
994-
plt.rcParams['date.interval_multiples']='True'
995-
fig,ax=plt.subplots()
996-
997-
ax.plot(dates,np.arange(len(dates)))
998-
fig.canvas.draw()
999-
assertax.get_xticklabels()[0].get_text()=='Jan 15 2020'
1000-
assertax.get_xticklabels()[1].get_text()=='Feb 01 2020'
1001-
1002-
1003952
deftest_epoch2num():
1004953
mdates._reset_epoch_test_example()
1005954
mdates.set_epoch('0000-12-31')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp