Plot coercing the axis to treat floats as dates.
Discouraged
This method exists for historic reasons and will be deprecated in the future.
datetime
-like data should directly be plotted using plot
.ax.xaxis.axis_date
/ ax.yaxis.axis_date
before plot
. See Axis.axis_date
.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
and numpy.datetime64
objects without resorting to this method.
The coordinates of the data points. If xdate or ydate is True, the respective values x or y are interpreted as Matplotlib dates.
The plot format string. For details, see the corresponding parameter in plot
.
datetime.tzinfo
, default: rcParams["timezone"]
(default: 'UTC'
)
The time zone to use in labeling dates.
If True, the x-axis will be interpreted as Matplotlib dates.
If True, the y-axis will be interpreted as Matplotlib dates.
Line2D
Objects representing the plotted data.
If given, the following parameters also accept a string s
, which is interpreted as data[s]
(unless this raises an exception):
x, y
Keyword arguments control the Line2D
properties:
Property | Description |
---|---|
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array | |
scalar or None | |
bool | |
| bool |
bool | |
Patch or (Path, Transform) or None | |
| color |
| |
| |
sequence of floats (on/off ink in points) or (None, None) | |
(2, N) array or two 1D arrays | |
| {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default' |
{'full', 'left', 'right', 'bottom', 'top', 'none'} | |
str | |
bool | |
object | |
| {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} |
| float |
marker style string, | |
| color |
| float |
| color |
| color |
| float |
None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool] | |
float or callable[[Artist, Event], tuple[bool, dict]] | |
float | |
bool | |
(scale: float, length: float, randomness: float) | |
bool or None | |
| |
| |
unknown | |
str | |
bool | |
1D array | |
1D array | |
float |
See also
matplotlib.dates
Helper functions on dates.
matplotlib.dates.date2num
Convert dates to num.
matplotlib.dates.num2date
Convert num to dates.
matplotlib.dates.drange
Create an equally spaced sequence of dates.
If you are using custom date tickers and formatters, it may be necessary to set the formatters/locators after the call to plot_date
. plot_date
will set the default tick locator to AutoDateLocator
(if the tick locator is not already set to a DateLocator
instance) and the default tick formatter to AutoDateFormatter
(if the tick formatter is not already set to a DateFormatter
instance).
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.5.1/api/_as_gen/matplotlib.axes.Axes.plot_date.html