MMMPlotSuite.contributions_over_time#

MMMPlotSuite.contributions_over_time(var, hdi_prob=0.85, dims=None, combine_dims=False, figsize=None)[source]#

Plot the time-series contributions for each variable in var.

showing the median and the credible interval (default 85%). Creates one subplot per combination of non-(chain/draw/date) dimensions and places all variables on the same subplot.

Parameters:
varlist of str

A list of variable names to plot from the posterior.

hdi_prob: float, optional

The probability mass of the highest density interval to be displayed. Default is 0.85.

dimsdict[str, str | int | list], optional

Dimension filters to apply. Example: {“country”: [“US”, “UK”], “user_type”: “new”}. If provided, only the selected slice(s) will be plotted.

combine_dimsbool, optional

If True, all dimension combinations are plotted on a single axis with different colors. If False (default), creates separate subplots for each dimension combination.

figsizetuple of float, optional

Figure size as (width, height) in inches. If None (default), size is calculated automatically based on the number of subplots.

Returns:
figmatplotlib.figure.Figure

The Figure object containing the subplots.

axesnp.ndarray of matplotlib.axes.Axes

Array of Axes objects corresponding to each subplot row.

Raises:
ValueError

If hdi_prob is not between 0 and 1, instructing the user to provide a valid value.