Arviz figures not showing up after sampling (GNU/Linux)

Dear all,

This should be a really stupid issue, but I can’t seem to make the ArviZ figures show up.

I am using GNU/Linux and I have checked that matplotlib works and shows the figure (with this example: https://matplotlib.org/stable/gallery/lines_bars_and_markers/simple_plot.html ).

But when I use the following in the python command line, after my modelling and sampling, nothing shows up:

wiith simple_model:
    az.plot_trace(s)

I am sure is something very basic, but my python skills are also very basic. And also I am aware that this is not something purely pyMC related. Excuse me.

Can someone give me a tip on how to proceed or how to make it appear in a TkAgg window?

Thank you very much.

1 Like

Try this out and see if that fixes things.

2 Likes

Thank you @cluhmann . That was it. I don’t know how after some minutes searching and searching I didn’t come across that. Sorry. Now, as a plus, I see a bit better how the integration between arviZ and matplotlib is based on.

2 Likes

Many, many graphics/plotting tools available in the python ecosystem use matplotlib “under the hood” because it is so reliable and flexible. So this sort of thing is common to run into.

1 Like

OK. I’ll have it in my mind. I remember a few time (years?) ago also trying other python things and matplotlib being very complicated to use, with all the backends (gtk, qt5, cairo, agg, tk…). This seems to work now out of the box. Thank you again.

2 Likes

To add to @cluhmann’s answer, the default in ArviZ is to not show the plot, because this allows users to further customize the plot and change labels, the title or the appearance of the plot manually.

Moreover, for convenience, plotting functions also have a show argument that can be set to True to indicate ArviZ to call plt.show under the hood.

If you don’t ever plan to customize ArviZ plots, you can also use an rcParam to change the default of this show argument. I believe this blogpost will help with rcParams: ArviZ customization with rcParams | Oriol unraveled

1 Like

Thank you for the tip, @OriolAbril .