MMMPlotSuite.budget_allocation#

MMMPlotSuite.budget_allocation(samples, scale_factor=None, figsize=(12, 6), ax=None, original_scale=True)[source]#

Plot the budget allocation and channel contributions.

Creates a bar chart comparing allocated spend and channel contributions for each channel. If additional dimensions besides ‘channel’ are present, creates a subplot for each combination of these dimensions.

Parameters:
samplesxr.Dataset

The dataset containing the channel contributions and allocation values. Expected to have ‘channel_contribution’ and ‘allocation’ variables.

scale_factorfloat, optional

Scale factor to convert to original scale, if original_scale=True. If None and original_scale=True, assumes scale_factor=1.

figsizetuple[float, float], optional

The size of the figure to be created. Default is (12, 6).

axplt.Axes, optional

The axis to plot on. If None, a new figure and axis will be created. Only used when no extra dimensions are present.

original_scalebool, optional

A boolean flag to determine if the values should be plotted in their original scale. Default is True.

Returns:
figmatplotlib.figure.Figure

The Figure object containing the plot.

axesmatplotlib.axes.Axes or numpy.ndarray of matplotlib.axes.Axes

The Axes object with the plot, or array of Axes for multiple subplots.