gEconpy.plotting.plot_irf#

gEconpy.plotting.plot_irf(irf, vars_to_plot=None, shocks_to_plot=None, n_cols=None, legend=False, cmap=None, legend_kwargs=None, figsize=(14, 10), dpi=100)#

Plot the impulse response functions for a set of variables.

Parameters:
irfxr.DataArray, list of xr.DataArray, or dict of xr.DataArray

A DataArray with the impulse response functions. The index should contain the variables to plot, and the columns should contain the shocks, with a multi-index for the period and shock type. When plotting multiple scenarios, provide a list of DataArrays or a dictionary with the scenario names as keys.

group: str, optional

The group from the InferenceData to plot. Must be one of “prior” or “posterior”. Default is ‘posterior’.

vars_to_plotlist of str, optional

A list of variables to plot. If not provided, all variables in the DataFrame will be plotted.

shocks_to_plotlist of str, optional

A list of shocks to plot. If not provided, all shocks in the DataFrame will be plotted.

n_colsint, optional

The number of columns to use in the plot grid. If not provided, the number of columns will be determined automatically based on the number of variables to plot.

legendbool, optional

Whether to show a legend with the shocks.

cmapstr or Colormap, optional

The color map to use for the impulse response functions.

legend_kwargsdict, optional

Keyword arguments to pass to matplotlib.figure.Figure.legend().

figsizetuple, optional

The size of the figure in inches.

dpiint, optional

The DPI of the figure.

Returns:
matplotlib.figure.Figure

The figure object.