MCPcopy Create free account
hub / github.com/unit8co/darts / plot

Function plot

darts/utils/_plotting.py:177–349  ·  view source on GitHub ↗

Plot a TimeSeries using Matplotlib. Parameters ---------- series The TimeSeries to plot. new_plot Whether to spawn a new axis to plot on. See also parameter `ax`. central_quantile The quantile (between 0 and 1) to plot as a "central" value, if the series

(
    series: TimeSeries,
    new_plot: bool = False,
    central_quantile: float | str = 0.5,
    low_quantile: float | None = 0.05,
    high_quantile: float | None = 0.95,
    default_formatting: bool = True,
    title: str | None = None,
    label: str | Sequence[str] | None = "",
    max_nr_components: int = 10,
    ax: matplotlib.axes.Axes | None = None,
    alpha: float | None = None,
    color: str | tuple | Sequence[str, tuple] | None = None,
    c: str | tuple | Sequence[str, tuple] | None = None,
    *args,
    **kwargs,
)

Source from the content-addressed store, hash-verified

175
176
177def plot(
178 series: TimeSeries,
179 new_plot: bool = False,
180 central_quantile: float | str = 0.5,
181 low_quantile: float | None = 0.05,
182 high_quantile: float | None = 0.95,
183 default_formatting: bool = True,
184 title: str | None = None,
185 label: str | Sequence[str] | None = "",
186 max_nr_components: int = 10,
187 ax: matplotlib.axes.Axes | None = None,
188 alpha: float | None = None,
189 color: str | tuple | Sequence[str, tuple] | None = None,
190 c: str | tuple | Sequence[str, tuple] | None = None,
191 *args,
192 **kwargs,
193) -> matplotlib.axes.Axes:
194 """Plot a TimeSeries using Matplotlib.
195
196 Parameters
197 ----------
198 series
199 The TimeSeries to plot.
200 new_plot
201 Whether to spawn a new axis to plot on. See also parameter `ax`.
202 central_quantile
203 The quantile (between 0 and 1) to plot as a "central" value, if the series is stochastic (i.e., if
204 it has multiple samples). This will be applied on each component separately (i.e., to display quantiles
205 of the components' marginal distributions). For instance, setting `central_quantile=0.5` will plot the
206 median of each component. `central_quantile` can also be set to 'mean'.
207 low_quantile
208 The quantile to use for the lower bound of the plotted confidence interval. Similar to `central_quantile`,
209 this is applied to each component separately (i.e., displaying marginal distributions). No confidence
210 interval is shown if `low_quantile` is None (default 0.05).
211 high_quantile
212 The quantile to use for the upper bound of the plotted confidence interval. Similar to `central_quantile`,
213 this is applied to each component separately (i.e., displaying marginal distributions). No confidence
214 interval is shown if `high_quantile` is None (default 0.95).
215 default_formatting
216 Whether to use the darts default scheme.
217 title
218 Optionally, a plot title.
219 label
220 Can either be a string or list of strings. If a string and the series only has a single component, it is
221 used as the label for that component. If a string and the series has multiple components, it is used as
222 a prefix for each component name. If a list of strings with length equal to the number of components in
223 the series, the labels will be mapped to the components in order.
224 max_nr_components
225 The maximum number of components of a series to plot. -1 means all components will be plotted.
226 ax
227 Optionally, an axis to plot on. If `None`, and `new_plot=False`, will use the current axis. If
228 `new_plot=True`, will create a new axis.
229 alpha
230 Optionally, set the line alpha for deterministic series, or the confidence interval alpha for
231 probabilistic series.
232 color
233 Can either be a single color or list of colors. Any matplotlib color is accepted (string, hex string,
234 RGB/RGBA tuple). If a single color and the series only has a single component, it is used as the color

Callers

nothing calls this directly

Calls 6

_prepare_plot_paramsFunction · 0.85
_compute_central_seriesFunction · 0.85
_compute_quantile_boundsFunction · 0.85
to_seriesMethod · 0.80
plotMethod · 0.80
start_timeMethod · 0.80

Tested by

no test coverage detected