infer-actively / pymdp

A Python implementation of active inference for Markov Decision Processes
MIT License
450 stars 89 forks source link

fix plot_likelihood in some examples #95

Closed tverbele closed 2 years ago

tverbele commented 2 years ago

plot_likelihood is missing a row in some of the examples?

conorheins commented 2 years ago

Hi @tverbele -- maybe it's something to do with my version of seaborn/Python, but I don't really see any noticeable difference made by increasing the number of xticks/yticks by one? See the two images below for examples of the plot outputs with/without your changes.

Without: image

With: image

Basically the only difference I can see between Without and With, is that there is an extra tick at the end of each axis (bottom left and bottom right, respectively) with your change (note: you may need to click on the images themselves to open them in a separate html page with a white background to distinguish the ticks). Is there a reason /some context where think this is helpful / necessary?

tverbele commented 2 years ago

When I execute the tmaze_demo example I get with master:

image

whereas with my patch

image

Which version of matplotlib / seaborn are you using? I'm testing with matplotlib==3.2.2 seaborn==0.11.2

Regardless, it might be a good to move the plot_xxx functions to utils or another pymdp module instead of re-defining them in multiple examples?

tverbele commented 2 years ago

Ok, I also checked on a different machine with a more recent matplotlib version (3.5.2), and there it does work correctly ... so probably just a bug in matplotlib.

conorheins commented 2 years ago

Hey @tverbele, as we discussed, although you closed this PR/deleted the branch, I'm going to start an issue / reference this PR and will move the plot_xxx functions to utils or another module to address this issue, while also adding in the explicit axes arguments to facilitate compatibility with earlier matplotlib (e.g. 3.2.2)