Interactive Mode is not Automatically Enabled in Jupyter
General
- pyfar version: Most recent git commit https://github.com/pyfar/pyfar/commit/90105bcff69be66753cb6a3d921150f58b98cac7 and matplotlib 3.9.0
- Python version: 3.11.8
- Operating System: Windows 11 23H2
- Did you install pyfar via pip: No, with rye in a venv
Description
When using pyfar to plot in a Jupyter notebook, only the first plot is shown automatically, the next ones aren't.
The workaround is to put
%matplotlib inline
at the top of the notebook. Thus, it's a low priority issue but it annoys me every time I encounter it.
Using matplotlib 3.7.0 and the most recent release pyfar 0.6.5, everything works as expected.
What I Did
The second plot command does not show automatically.
For comparison, this works with plain pyplot:
Yes, we know this and feel your pain. This behavior changed a while ago as part of a Matplotlib or Jupyter update. We don't think this is a pyfar issue and decided not to work on this. It could probably be fixed, e.g., by adding a default backend to all pyfar plots, but this would be very intrusive and annoying if you want to use a different one. Another possibility would be a config file, but this would be rather hidden from the user and prone to unexoected behavior 😥
Good to know that you are aware 👍
I'm also having trouble reproducing the working behavior.
I have a venv where it works as described, however when I create a new venv with exactly the same versions of Python and all packages, it doesn't 🤷♂️. I can't rule out a bug in my version manager rye either. The folders of the two venvs are practically identical, only the binary files in .venv/Scripts are different but I'm not sure why.
When inspiration strikes I'll get back to it and maybe at some point I'll be able to reproduce the behavior and pinpoint a source.