SyntheticControl.plot#
- SyntheticControl.plot(*, round_to=None, treated_unit=None, hdi_prob=0.94, plot_predictors=False, figsize=(7, 8), show=True, legend_kwargs=None)[source]#
Plot the synthetic control results for a specific treated unit.
- Parameters:
round_to (
int|None) – Number of decimals used to round numerical results in the figure title (e.g. the Bayesian \(R^2\)). Defaults toNone, in which case 2 significant figures are used.treated_unit (
str|None) – Which treated unit to plot. Must be one of the names supplied viatreated_unitsat construction time. Defaults toNone, which selects the first treated unit.hdi_prob (
float) – Probability mass of the highest density interval drawn around the posterior predictive, causal impact, and cumulative impact bands. Must be in(0, 1]. Ignored for OLS models. Defaults toHDI_PROB(currently 0.94).plot_predictors (
bool) – Whether to overlay the donor (control) unit trajectories on the top panel. Defaults toFalse.figsize (
tuple[float,float]) – Width and height of the figure in inches, passed tomatplotlib.pyplot.subplots(). Defaults to(7, 8).show (
bool) – Whether to automatically display the plot. Defaults toTrue. Set toFalseif you want to modify the figure before displaying it.legend_kwargs (
dict[str,Any] |None) – Keyword arguments to adjust legend placement and styling. Supported keys:loc,bbox_to_anchor,fontsize,frameon,title(bbox_transformis accepted alongsidebbox_to_anchor). The existing legend is modified in place so that custom handles are preserved.
- Returns:
fig (matplotlib.figure.Figure) – The figure that was created.
ax (list[matplotlib.axes.Axes]) – The three axes (top: predictions, middle: causal impact, bottom: cumulative impact).
- Return type: