matplotlib.pyplot.plot_date — Matplotlib 3.10.3 documentation (original) (raw)

matplotlib.pyplot.plot_date(x, y, fmt='o', tz=None, xdate=True, ydate=False, *, data=None, **kwargs)[source]#

[_Deprecated_] Plot coercing the axis to treat floats as dates.

Deprecated since version 3.9: This method exists for historic reasons and will be removed in version 3.11.

Similar to plot, this plots y vs. x as lines or markers. However, the axis labels are formatted as dates depending on _xdate_and ydate. Note that plot will work with datetime andnumpy.datetime64 objects without resorting to this method.

Parameters:

x, yarray-like

The coordinates of the data points. If xdate or ydate is_True_, the respective values x or y are interpreted asMatplotlib dates.

fmtstr, optional

The plot format string. For details, see the corresponding parameter in plot.

tztimezone string or datetime.tzinfo, default: [rcParams["timezone"]](../../users/explain/customizing.html?highlight=timezone#matplotlibrc-sample) (default: 'UTC')

The time zone to use in labeling dates.

xdatebool, default: True

If True, the _x_-axis will be interpreted as Matplotlib dates.

ydatebool, default: False

If True, the _y_-axis will be interpreted as Matplotlib dates.

Returns:

list of Line2D

Objects representing the plotted data.

Other Parameters:

dataindexable object, optional

If given, the following parameters also accept a string s, which is interpreted as data[s] if s is a key in data:

x, y

**kwargs

Keyword arguments control the Line2D properties:

Notes

If you are using custom date tickers and formatters, it may be necessary to set the formatters/locators after the call toplot_date. plot_date will set the default tick locator toAutoDateLocator (if the tick locator is not already set to aDateLocator instance) and the default tick formatter toAutoDateFormatter (if the tick formatter is not already set to aDateFormatter instance).

Deprecated since version 3.9: Use plot instead.