I spent several hours googling and trying myself to change my code to fix
this. No luck in googling and the fact that there was a kind of doing brain
surgery on Matplotlib by uninstall, re-install and update and change backend
library for a similar but not quite the same problem made me think that I
should post the solution somewhere since it was almost impossible to spot.
It could be a LaTeX problem causing it!
The reason for the blank plot was that I had used a LaTeX escape character
for the value 0 when creating nice labels for the x axis. Apparently, using
'$\0$' to write the number zero in LaTeX makes the plots blank and kills the
interactivity. Restarting the kernel did no good.
If I instead write '$0$' as a label, everything works fine again.
My environment is Mac OSX 10.13.6, Matplotlib 3.0.2, Python 3.7.1, running
in Jupyter (notebook server version 5.7.4, IPython 7.2.0) in Safari Version
12.0 (13606.2.11).
If you want to see my code, please request it and then I will post it.
On Fri, May 17, 2019 at 5:19 AM FilipPersson <filip at ownit.nu> wrote:
I spent several hours googling and trying myself to change my code to fix
this. No luck in googling and the fact that there was a kind of doing brain
surgery on Matplotlib by uninstall, re-install and update and change
backend
library for a similar but not quite the same problem made me think that I
should post the solution somewhere since it was almost impossible to spot.
It could be a LaTeX problem causing it!
The reason for the blank plot was that I had used a LaTeX escape character
for the value 0 when creating nice labels for the x axis. Apparently, using
'\\0' to write the number zero in LaTeX makes the plots blank and kills
the
interactivity. Restarting the kernel did no good.
If I instead write '0' as a label, everything works fine again.
My environment is Mac OSX 10.13.6, Matplotlib 3.0.2, Python 3.7.1, running
in Jupyter (notebook server version 5.7.4, IPython 7.2.0) in Safari Version
12.0 (13606.2.11).
If you want to see my code, please request it and then I will post it.
Hi Tom,
I'm not sure if it's related. I'm using nbAgg. It acme automatically when I
installed and I haven't changed it. Their plots go black. Not all my plots
go crazy when I do the escape character error, only the interactive ones
when re-running.
If you look in your terminal do you see a bunch of tracebacks?
The problem is that Python read \0 in a string literal as an escaped 0 byte
(aka \x00) which fails to parse with with mathtex and latex. If you make a
raw string (r"\\0") python won't interpret the escape character, but both
mathtex and latex still fail as \0 is not a valid command it latex. These
exceptions are being raised as part of the draw process which cause it to
fail which makes it look like interactivity is lost because the updated
image is not shipped to the browser.
We should sort out a better way to surface those exceptions, the problem is
that they happen asynchronously so it is not clear where they should be
raised...
Tom
···
On Sun, May 19, 2019 at 3:51 AM FilipPersson <filip at ownit.nu> wrote:
Hi Tom,
I'm not sure if it's related. I'm using nbAgg. It acme automatically when I
installed and I haven't changed it. Their plots go black. Not all my plots
go crazy when I do the escape character error, only the interactive ones
when re-running.