BudgetPlots.contribution_over_time#
- BudgetPlots.contribution_over_time(samples, dims=None, hdi_prob=0.94, figsize=None, backend=None, return_as_pc=False, line_kwargs=None, hdi_kwargs=None, **pc_kwargs)[source]#
Time-series of channel contributions from an optimised budget allocation.
Creates one panel per extra-dimension combination (e.g. one per geo). Each panel shows a mean line and HDI band per channel.
- Parameters:
- samples
xr.Dataset Output of
mmm.allocate_budget_to_maximize_response(...)or equivalent. Must have:a variable whose name contains
"channel_contribution"(dims:sample,date,channel, …)
- dims
dict, optional Dimension filters, e.g.
{"geo": ["CA"]}.- hdi_prob
float, default 0.85 HDI probability mass.
- figsize
tuple, optional Injected into
figure_kwargs.- backend
str, optional Rendering backend. Non-matplotlib requires
return_as_pc=True.- return_as_pcbool, default
False Return the
PlotCollectioninstead of(Figure, NDArray[Axes]).- line_kwargs
dict, optional Extra kwargs forwarded to
azp.visuals.line_xy.- hdi_kwargs
dict, optional Extra kwargs forwarded to
azp.visuals.fill_between_y.- **pc_kwargs
Forwarded to
PlotCollection.wrap().
- samples
- Returns:
tuple[Figure,NDArray[Axes]] orPlotCollection