MMM.plot_grouped_contribution_breakdown_over_time#

MMM.plot_grouped_contribution_breakdown_over_time(stack_groups=None, original_scale=False, area_kwargs=None, **plt_kwargs)#

Plot a time series area chart for all channel contributions.

Since a chart like this can become quite crowded if you have many channels or control variables, you can group certain variables together using the stack_groups keyword.

Parameters:
  • stack_groups (dict of {str: list of str}, optional) –

    Specifies which variables to group together. Example: passing

    {

    “Baseline”: [“intercept”], “Offline”: [“TV”, “Radio”], “Online”: [“Banners”]

    }

    results in a chart with three colors, one for Baseline, one for Online, and one for Offline. If stack_groups is None, the chart would have four colors since TV and Radio would be separated.

    Note: If you only pass {“Baseline”: “intercept”, “Online”: [“Banners”]}, you will not see the TV and Radio channels in the chart.

  • original_scale (bool, by default False) – If True, the contributions are plotted in the original scale of the target.

Returns:

Matplotlib figure with the plot.

Return type:

plt.Figure