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:
- irf
xr.DataArray,listofxr.DataArray, ordictofxr.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_plot
listofstr, optional A list of variables to plot. If not provided, all variables in the DataFrame will be plotted.
- shocks_to_plot
listofstr, optional A list of shocks to plot. If not provided, all shocks in the DataFrame will be plotted.
- n_cols
int, 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.
- cmap
strorColormap, optional The color map to use for the impulse response functions.
- legend_kwargs
dict, optional Keyword arguments to pass to matplotlib.figure.Figure.legend().
- figsize
tuple, optional The size of the figure in inches.
- dpi
int, optional The DPI of the figure.
- irf
- Returns:
matplotlib.figure.FigureThe figure object.