Bug? Plots + pyplot()

I’m on Windows 11 (64bit), latest update as of now. I use Julia v1.6.3, latest update as of today with all packages.

When I do simple plots using the pyplot() backend, my Jupyter notebook crashes with the following error message:

If I switch to gr() backend, the code runs without problems.

The same happens if I run another notebook.

The problem appears to have started a few days ago when I updated the Julia packages, where amongst others pyplot() had to be installed via Conda.add(), etc.

The reason why I still prefer to use pyplot() over gr() is that:

  • gr() still has weak spots wrt. rendering text with LaTeX symbols.
  • gr() sometimes gives “ugly” results, e.g., the following when plotting the result of a Turing model fit:

    [GR incorrectly doesn’t show the ylabel in the left column, and the label in the right column (“Density)” is written into the area of the left column.]

It would be nice to have a MWE example to try to understand when and why this sometimes happens. Thank you.

1 Like

OK – for the Kernel restarting problem:

using Plots
pyplot()
#
x = range(0,2pi,length=50)
plot(x,sin)

leads to

while

using Plots
#pyplot()
#
x = range(0,2pi,length=50)
plot(x,sin)

uses gr() and works.

This happens with gr() every time I run a Turing problem and do:

par_NUTS = sample(model,NUTS(100,0.75),Npos)
plot(par_NUTS)

leads to

I can try to can make a complete, yet simple MWE. Possibly by stealing an example from the Turing documentation.

Not familiar with Turing.jl but it seems that some Plots recipe is missing/broken.
Have you tried using StatsPlots to see if an appropriate recipe is triggered?

Yes, I have included using StatsPlots – with the same result. Note: pyplot handed this fine – that is, before it started to kill the kernel…

Ok, maybe you should open an issue then.

1 Like

I’ll try to do that. The bigger problem for me, though, is that pyplot() makes the notebook session crash.

1 Like