pyfar icon indicating copy to clipboard operation
pyfar copied to clipboard

Interactive Mode is not Automatically Enabled in Jupyter

Open Firionus opened this issue 1 year ago • 2 comments

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

Screenshot No Pyfar Plot

The second plot command does not show automatically.

For comparison, this works with plain pyplot:

Screenshot Pyplot works

Firionus avatar Jun 06 '24 07:06 Firionus

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 😥

f-brinkmann avatar Jun 06 '24 07:06 f-brinkmann

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.

Firionus avatar Jun 06 '24 12:06 Firionus