Hi all,
I’m using PyMC5.
When I try to show a trace plot, the outcome is weird and hard to read.
Please see the screenshot below.
The upper graph and lower graph overlap and their caption is hard to read, right?
How do I make the interval between 2 graphs wider?
I couldn’t find any option for az.plot_trace() to do this.
The attached is the result of az.plot_trace(trace)
My versions are
Jupyter Lab : 4.0.7
PyMC: v5.16.2
OS: MacOS 12.4
Jupyter Lab is running on Docker Desktop(Docker Engine v20.10.17).
az.plot_trace just does matplotlib stuff, so all the usual matplotlib rules apply.
In this case, you can just call plt.tight_layout() after az.plot_trace(idata). If you wanted to be fancy, you can use plt.gcf() to get the figure object that arviz created and call fig.tight_layout() or fig.use_constrained_layout(), as in:
constrained_layout is the recommended method by matplotlib devs (over tight_layout). You can set it as @jessegrabowski already explained.
constrained_layout is set to True if you use any of the styles provided by ArviZ, for instance az.style.use("arviz-doc"), Other available styles are listed here Matplotlib styles — ArviZ 0.19.0 documentation or you can define your own style.
Thank you for a really great suggestion, Mr. @aloctavodia
I’m reading your book “BAP” which I love and I encountered the problem shown above while I was reading the book.