Using: PyMC v4.4.0: Arviz v0.14.0
Can anyone change the fontsize of the ‘model names’ on a az.plot_forest() plot.
Nothing I tried has worked!
Has anybody found a method of reducing the textsize of the model names?
thanking you in advance for trying. declan
I tried changing only the legend size from
plot_forest but I didn’t find how…
az.plot_forest is based on
matplotlib you can change the global legend size of your notebook or code by running the following
import matplotlib.pyplot as plt
note that this will change the size of the text in ALL legends that you plot after running the code.
Thanks for your reply. yes this changes all the fonts but labels and title fonts can then be independently increased using: ax.set_ylabel(‘Posterior Parameters Hdi=95%’,fontsize=10)
ax.set_title(‘Posterior Parameters Hdi=95%’,fontsize=18). Surprisingly, there does not seem direct way to achieve model labels alone, this, so your method / solution is appreciated. Declan
You can modify the text instances of the legend items with the following code:
legend = ax.get_legend()
for text in legend.get_texts():
Note you can set fontsize only to modify it, or any other property of the text. matplotlib.text — Matplotlib 3.6.3 documentation has all the properties you can modify like this.
Thanks, it works brillantly !