aloctavodia / BAP3

Figures and code examples from Bayesian Analysis with Python (third edition)
http://bap.com.ar/
142 stars 41 forks source link

Question regarding plot for the simple regression example in chapter 4 #13

Closed carsten-j closed 5 months ago

carsten-j commented 6 months ago

I understand the code behind figure 4.4. Looking around in Arviz I discovered the plotting funtion plot_lm that should be able to do something similar to the plots in figure 4.4. I would like to replace the Python code for fig 4.4 with a single method call :-)

In the attached notebook I have created a slimmed down version of the example and added a call to plot_lm. However I have problems getting it to work. It looks like some naming convention issue for coords in the inferencedata object.

In the notebook I describe both what problem I experience and how I fix it. Can you please advice if there is a better way of doing this. Thanks.

Chp_04.ipynb.md

aloctavodia commented 5 months ago

Sorry, I missed this. We are not very happy with plot_lm in ArviZ. As it is not as flexible as we would like to be. We are working on a completely new version of ArviZ and we are currently discussing whether we should deprecate "plot_lm" for that version, at the same time. Writing a custom plot_lm-like plot should become much easier in the new version. You can take a look at the new ArviZ here, https://arviz-plots.readthedocs.io/en/latest/

carsten-j commented 5 months ago

Thanks for clarifying. It sounds great. I have had a lot of difficulties using and understanding plot_lm. I will take a look at the latest version of ArviZ.