Skip to content

Commit a07d52c

Browse files
committed
MNT: remove plot_date
1 parent 03b74ea commit a07d52c

File tree

18 files changed

+16
-221
lines changed

18 files changed

+16
-221
lines changed

doc/api/axes_api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Basic
5454
Axes.errorbar
5555
Axes.scatter
5656

57-
Axes.plot_date
5857
Axes.step
5958

6059
Axes.loglog
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
``plot_date``
2+
~~~~~~~~~~~~~
3+
4+
Use of ``plot_date`` has been discouraged since Matplotlib 3.5 and deprecated
5+
since 3.9. The ``plot_date`` function has now been removed.
6+
7+
- ``datetime``-like data should directly be plotted using `~.Axes.plot`.
8+
- If you need to plot plain numeric data as :ref:`date-format` or need to set
9+
a timezone, call ``ax.xaxis.axis_date`` / ``ax.yaxis.axis_date`` before
10+
`~.Axes.plot`. See `.Axis.axis_date`.

doc/api/prev_api_changes/api_changes_1.4.x.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Code changes
139139
``matplotlib.testing.image_util.autocontrast``. These will be removed
140140
completely in v1.5.0.
141141

142-
* The ``fmt`` argument of :meth:`~matplotlib.axes.Axes.plot_date` has been
142+
* The ``fmt`` argument of ``Axes.plot_date`` has been
143143
changed from ``bo`` to just ``o``, so color cycling can happen by default.
144144

145145
* Removed the class ``FigureManagerQTAgg`` and deprecated

doc/api/prev_api_changes/api_changes_3.5.0/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type. See their documentation for the types they expect.
4747
Discouraged: ``plot_date``
4848
~~~~~~~~~~~~~~~~~~~~~~~~~~
4949

50-
The use of `~.Axes.plot_date` is discouraged. This method exists for historic
50+
The use of ``plot_date`` is discouraged. This method exists for historic
5151
reasons and may be deprecated in the future.
5252

5353
- ``datetime``-like data should directly be plotted using `~.Axes.plot`.

doc/api/prev_api_changes/api_changes_3.9.0/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Deprecations
44
``plot_date``
55
^^^^^^^^^^^^^
66

7-
Use of `~.Axes.plot_date` has been discouraged since Matplotlib 3.5 and the function is
7+
Use of ``plot_date`` has been discouraged since Matplotlib 3.5 and the function is
88
now formally deprecated.
99

1010
- ``datetime``-like data should directly be plotted using `~.Axes.plot`.

doc/api/pyplot_summary.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Basic
5151
plot
5252
errorbar
5353
scatter
54-
plot_date
5554
step
5655
loglog
5756
semilogx

lib/matplotlib/axes/_axes.py

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,87 +1778,6 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs):
17781778
self._request_autoscale_view("y")
17791779
return lines
17801780

1781-
@_api.deprecated("3.9", alternative="plot")
1782-
@_preprocess_data(replace_names=["x", "y"], label_namer="y")
1783-
@_docstring.interpd
1784-
def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False,
1785-
**kwargs):
1786-
"""
1787-
Plot coercing the axis to treat floats as dates.
1788-
1789-
.. deprecated:: 3.9
1790-
1791-
This method exists for historic reasons and will be removed in version 3.11.
1792-
1793-
- ``datetime``-like data should directly be plotted using
1794-
`~.Axes.plot`.
1795-
- If you need to plot plain numeric data as :ref:`date-format` or
1796-
need to set a timezone, call ``ax.xaxis.axis_date`` /
1797-
``ax.yaxis.axis_date`` before `~.Axes.plot`. See
1798-
`.Axis.axis_date`.
1799-
1800-
Similar to `.plot`, this plots *y* vs. *x* as lines or markers.
1801-
However, the axis labels are formatted as dates depending on *xdate*
1802-
and *ydate*. Note that `.plot` will work with `datetime` and
1803-
`numpy.datetime64` objects without resorting to this method.
1804-
1805-
Parameters
1806-
----------
1807-
x, y : array-like
1808-
The coordinates of the data points. If *xdate* or *ydate* is
1809-
*True*, the respective values *x* or *y* are interpreted as
1810-
:ref:`Matplotlib dates <date-format>`.
1811-
1812-
fmt : str, optional
1813-
The plot format string. For details, see the corresponding
1814-
parameter in `.plot`.
1815-
1816-
tz : timezone string or `datetime.tzinfo`, default: :rc:`timezone`
1817-
The time zone to use in labeling dates.
1818-
1819-
xdate : bool, default: True
1820-
If *True*, the *x*-axis will be interpreted as Matplotlib dates.
1821-
1822-
ydate : bool, default: False
1823-
If *True*, the *y*-axis will be interpreted as Matplotlib dates.
1824-
1825-
Returns
1826-
-------
1827-
list of `.Line2D`
1828-
Objects representing the plotted data.
1829-
1830-
Other Parameters
1831-
----------------
1832-
data : indexable object, optional
1833-
DATA_PARAMETER_PLACEHOLDER
1834-
**kwargs
1835-
Keyword arguments control the `.Line2D` properties:
1836-
1837-
%(Line2D:kwdoc)s
1838-
1839-
See Also
1840-
--------
1841-
matplotlib.dates : Helper functions on dates.
1842-
matplotlib.dates.date2num : Convert dates to num.
1843-
matplotlib.dates.num2date : Convert num to dates.
1844-
matplotlib.dates.drange : Create an equally spaced sequence of dates.
1845-
1846-
Notes
1847-
-----
1848-
If you are using custom date tickers and formatters, it may be
1849-
necessary to set the formatters/locators after the call to
1850-
`.plot_date`. `.plot_date` will set the default tick locator to
1851-
`.AutoDateLocator` (if the tick locator is not already set to a
1852-
`.DateLocator` instance) and the default tick formatter to
1853-
`.AutoDateFormatter` (if the tick formatter is not already set to a
1854-
`.DateFormatter` instance).
1855-
"""
1856-
if xdate:
1857-
self.xaxis_date(tz)
1858-
if ydate:
1859-
self.yaxis_date(tz)
1860-
return self.plot(x, y, fmt, **kwargs)
1861-
18621781
# @_preprocess_data() # let 'plot' do the unpacking..
18631782
@_docstring.interpd
18641783
def loglog(self, *args, **kwargs):

lib/matplotlib/axes/_axes.pyi

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,6 @@ class Axes(_AxesBase):
200200
data=...,
201201
**kwargs
202202
) -> list[Line2D]: ...
203-
def plot_date(
204-
self,
205-
x: ArrayLike,
206-
y: ArrayLike,
207-
fmt: str = ...,
208-
tz: str | datetime.tzinfo | None = ...,
209-
xdate: bool = ...,
210-
ydate: bool = ...,
211-
*,
212-
data=...,
213-
**kwargs
214-
) -> list[Line2D]: ...
215203
def loglog(self, *args, **kwargs) -> list[Line2D]: ...
216204
def semilogx(self, *args, **kwargs) -> list[Line2D]: ...
217205
def semilogy(self, *args, **kwargs) -> list[Line2D]: ...

lib/matplotlib/pyplot.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686

8787
if TYPE_CHECKING:
8888
from collections.abc import Callable, Hashable, Iterable, Sequence
89-
import datetime
9089
import pathlib
9190
import os
9291
from typing import Any, BinaryIO, Literal, TypeVar
@@ -3834,31 +3833,6 @@ def plot(
38343833
)
38353834

38363835

3837-
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
3838-
@_copy_docstring_and_deprecators(Axes.plot_date)
3839-
def plot_date(
3840-
x: ArrayLike,
3841-
y: ArrayLike,
3842-
fmt: str = "o",
3843-
tz: str | datetime.tzinfo | None = None,
3844-
xdate: bool = True,
3845-
ydate: bool = False,
3846-
*,
3847-
data=None,
3848-
**kwargs,
3849-
) -> list[Line2D]:
3850-
return gca().plot_date(
3851-
x,
3852-
y,
3853-
fmt=fmt,
3854-
tz=tz,
3855-
xdate=xdate,
3856-
ydate=ydate,
3857-
**({"data": data} if data is not None else {}),
3858-
**kwargs,
3859-
)
3860-
3861-
38623836
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
38633837
@_copy_docstring_and_deprecators(Axes.psd)
38643838
def psd(
Binary file not shown.

0 commit comments

Comments
 (0)