rdtools.plotting.degradation_timeseries_plot

rdtools.plotting.degradation_timeseries_plot(yoy_info, rolling_days=365, include_ci=True, fig=None, plot_color=None, ci_color=None, center=None, min_periods_divisor=None, **kwargs)

Plot resampled time series of degradation trend with time

Parameters:
  • yoy_info (dict) --

    a dictionary with keys:

    • YoY_values - pandas series of year on year slopes with integer index.

    • YoY_times - pandas DataFrame containing a dt_left, dt_center

      and dt_right timestamp columns, indexed by the same integer window id as YoY_values.

  • rolling_days (int, default 365) -- Number of days for rolling window. The window must contain at least rolling_days // min_periods_divisor datapoints to be included in the rolling plot.

  • include_ci (bool, default True) -- calculate and plot 2-sigma confidence intervals along with rolling median

  • fig (matplotlib, optional) -- fig object to add new plot to (first set of axes only)

  • plot_color (str, optional) -- color of the timeseries trendline

  • ci_color (str, optional) -- color of the confidence interval 'fuzz'

  • center (bool, default False) -- If True, the rolling window is centered and results_values is reindexed using yoy_info['YoY_times']['dt_center'] before any calculations are performed. The recommended value is True; the default of False is retained only for backward compatibility. A warning is raised when this argument is not explicitly supplied.

  • min_periods_divisor (int, optional) -- Divisor applied to rolling_days to set the minimum number of observations required in a window. Smaller values (e.g. 2) require the window to be more populated; larger values (e.g. 4) make the plot more resilient to small data outages without losing fidelity. Defaults to 2 in this release to match the behavior in rdtools prior to the multi-YoY changes. A FutureWarning is emitted when the default is used; the default will change to 4 in a future major release. Pass an explicit value to silence the warning.

  • kwargs -- Extra parameters passed to matplotlib.pyplot.axis.plot()

Note

It should be noted that yoy_info is an output from rdtools.degradation.degradation_year_on_year().

Return type:

matplotlib.figure.Figure