DifferenceInDifferences.plot#

DifferenceInDifferences.plot(*, round_to=None, hdi_prob=0.94, figsize=None, show=True, legend_kwargs=None)[source]#

Plot the difference-in-differences results.

Parameters:
  • round_to (int | None) – Number of decimals used to round numerical results in the figure title. Defaults to None, in which case 2 significant figures are used.

  • hdi_prob (float) – Probability mass of the highest density interval drawn around the posterior predictive bands for the control, treatment, and counterfactual trajectories. Must be in (0, 1]. Ignored for OLS models. Defaults to HDI_PROB (currently 0.94).

  • figsize (tuple[float, float] | None) – Width and height of the figure in inches, passed to matplotlib.pyplot.subplots(). Defaults to None (use matplotlib’s default).

  • show (bool) – Whether to automatically display the plot. Defaults to True. Set to False if 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_transform is accepted alongside bbox_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 (matplotlib.axes.Axes) – The axes object containing the plot.

Return type:

tuple[Figure, Axes]