Plotting using arviz

Hi,
I am trying to plot the trace using az.plot_trace. Since there are many subplots, the var_name of the bottom plot overlaps with the x-axis of the top plot. Is there any parameter inside az.plot_trace that I can use to increase the space between the two plots.

Using PyMC3 version: 3.11.5
Using ArviZ version: 0.12.1

az.plot_trace(trace,
              var_names=['a',
                         'control_holiday',
                         'control_closeratetotal',
                         'control_lsstotal'],
              divergences=False
             )
plt.show()

If you just change the size of the figure and increase the height, it should work out.

It’s also good to use plt.tight_layout()

You can use constrained layout or tight layout. I recommend the first option. You can activate it setting its rcparam:

plt.rcParams['figure.constrained_layout.use'] = True

Or to use this on a single plot basis, you can use backend_kwargs in plot_trace which as the docs indicate they are passed to matplotlib for figure creationwi th plt.subplots. Ref: Constrained Layout Guide β€” Matplotlib 3.7.1 documentation

2 Likes