Skip to content

Commit de6a915

Browse files
committed
Add pending deprecation to plot_date()
1 parent 705ed51 commit de6a915

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,8 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
17571757
self._request_autoscale_view(scalex=scalex, scaley=scaley)
17581758
return lines
17591759

1760+
@cbook.deprecated("3.4", pending=True,
1761+
alternative="plot() and if needed Axis.axis_date()")
17601762
@_preprocess_data(replace_names=["x", "y"], label_namer="y")
17611763
@docstring.dedent_interpd
17621764
def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,

lib/matplotlib/tests/test_axes.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,8 @@ def test_single_date():
619619
data1 = [-65.54]
620620

621621
fig, ax = plt.subplots(2, 1)
622-
ax[0].plot_date(time1 + dt, data1, 'o', color='r')
622+
with pytest.warns(PendingDeprecationWarning):
623+
ax[0].plot_date(time1 + dt, data1, 'o', color='r')
623624
ax[1].plot(time1, data1, 'o', color='r')
624625

625626

@@ -5431,11 +5432,13 @@ def test_date_timezone_x():
54315432
# Same Timezone
54325433
plt.figure(figsize=(20, 12))
54335434
plt.subplot(2, 1, 1)
5434-
plt.plot_date(time_index, [3] * 3, tz='Canada/Eastern')
5435+
with pytest.warns(PendingDeprecationWarning):
5436+
plt.plot_date(time_index, [3] * 3, tz='Canada/Eastern')
54355437

54365438
# Different Timezone
54375439
plt.subplot(2, 1, 2)
5438-
plt.plot_date(time_index, [3] * 3, tz='UTC')
5440+
with pytest.warns(PendingDeprecationWarning):
5441+
plt.plot_date(time_index, [3] * 3, tz='UTC')
54395442

54405443

54415444
@image_comparison(['date_timezone_y.png'])
@@ -5448,12 +5451,14 @@ def test_date_timezone_y():
54485451
# Same Timezone
54495452
plt.figure(figsize=(20, 12))
54505453
plt.subplot(2, 1, 1)
5451-
plt.plot_date([3] * 3,
5452-
time_index, tz='Canada/Eastern', xdate=False, ydate=True)
5454+
with pytest.warns(PendingDeprecationWarning):
5455+
plt.plot_date([3] * 3,
5456+
time_index, tz='Canada/Eastern', xdate=False, ydate=True)
54535457

54545458
# Different Timezone
54555459
plt.subplot(2, 1, 2)
5456-
plt.plot_date([3] * 3, time_index, tz='UTC', xdate=False, ydate=True)
5460+
with pytest.warns(PendingDeprecationWarning):
5461+
plt.plot_date([3] * 3, time_index, tz='UTC', xdate=False, ydate=True)
54575462

54585463

54595464
@image_comparison(['date_timezone_x_and_y.png'], tol=1.0)
@@ -5466,11 +5471,13 @@ def test_date_timezone_x_and_y():
54665471
# Same Timezone
54675472
plt.figure(figsize=(20, 12))
54685473
plt.subplot(2, 1, 1)
5469-
plt.plot_date(time_index, time_index, tz='UTC', ydate=True)
5474+
with pytest.warns(PendingDeprecationWarning):
5475+
plt.plot_date(time_index, time_index, tz='UTC', ydate=True)
54705476

54715477
# Different Timezone
54725478
plt.subplot(2, 1, 2)
5473-
plt.plot_date(time_index, time_index, tz='US/Eastern', ydate=True)
5479+
with pytest.warns(PendingDeprecationWarning):
5480+
plt.plot_date(time_index, time_index, tz='US/Eastern', ydate=True)
54745481

54755482

54765483
@image_comparison(['axisbelow.png'], remove_text=True)

0 commit comments

Comments
 (0)