plot_series#
- plot_series(*series, labels=None, markers=None, colors=None, title=None, x_label=None, y_label=None, ax=None, pred_interval=None)[source]#
Plot one or more time series.
This function allows you to plot one or more time series on a single figure via
series
. Used for making comparisons between different series.The resulting figure includes the time series data plotted on a graph with x-axis as time by default and can be changed via
x_label
and y-axis as value of time series can be renamed viay_label
and labels explaining the meaning of each series vialabels
, markers for data points viamarkers
. You can also specify custom colors viacolors
for each series and add a title to the figure viatitle
. If prediction intervals are available add them usingpred_interval
, they can be overlaid on the plot to visualize uncertainty.- Parameters:
- seriespd.Series or iterable of pd.Series
One or more time series
- labelslist, default = None
Names of series, will be displayed in figure legend
- markers: list, default = None
Markers of data points, if None the marker “o” is used by default. The length of the list has to match with the number of series.
- colors: list, default = None
The colors to use for plotting each series. Must contain one color per series
- title: str, default = None
The text to use as the figure’s suptitle
- pred_interval: pd.DataFrame, default = None
Output of
forecaster.predict_interval()
. Contains columns for lower and upper boundaries of confidence interval.- axmatplotlib axes, optional
Axes to plot on, if None, a new figure is created and returned
- Returns:
- figplt.Figure
It manages the final visual appearance and layout. Create a new figure, or activate an existing figure.
- axplt.Axis
Axes containing the plot If ax was None, a new figure is created and returned If ax was not None, the same ax is returned with plot added
Examples
>>> from sktime.utils.plotting import plot_series >>> from sktime.datasets import load_airline >>> y = load_airline() >>> fig, ax = plot_series(y)