-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
matplotlib 3.7 brakes plotting #524
Comments
@trackhacs thanks for reporting - happily this is already fixed by #517. If you upgrade to ipympl version |
I just tried it - and unfortunately the problem still with: matplotlib: 3.7.1 the difference now is, that the same plot is shown below each cell, but still containing the plotted information from both cells. edit: downgrading to matplotlib 3.6.3 solves this issue again. |
Can you please post a screenshot of what you mean? |
interesting. could not reproduce it on linux with ipympl 0.9.2 / 0.9.3 and matplotlib 3.7.1. will try later on windows. |
maybe to add. on windows the plots are done in different venv than jupyter. |
Ah ok that's helpful thank you! I think matplotlib is actually behaving in the way it's supposed to here, but it can be really confusing at first especially if you are coming from the inline backend. Formerly when you reloaded the backend with This is important because you are relying on the special case of there being no active figures to display them when you called The fix is to be more explicit about figure creation and which axis you are plotting to. so I would do it like this: fig, ax = plt.subplots()
ax.plot([1,2,3,4]) and then you can make a new figure fig, ax = plt.subplots()
ax.plot([4,3,2,1]) This is basically the same issue as #171 and #60. So it's clear that at very least we need better documentation of this. |
I found where I'd explained this more thoroughly before: #248 (comment) |
going to read #248 however - using jupyter notbook/lab since its creation - i am really used to that matplotlib keeps the current plot and that automatically creates a new one below the new cell - freezing the first interactive plot into an inline. this used to be default behavior: so this new behavior actually would be a regression for me, sadly. also over the years i got really scared to update jupyter - it always ended up in a couple of day |
So I think the change in behavior comes from this PR on matplotlib: matplotlib/matplotlib#22005 Also note that I'm sure that the way you were relying on the behavior of But hope is not lost I think you can have the behavior you want again by replacing the |
thx for feedback - will experiment and stay with 3.6.x till than. |
Also stumbled upon this, was also expecting the behavior @trackhacs was expecting. |
Describe the issue
i do first plot in cell, than try to plot a second plot in a new cell, each starting with "%matplotlib widget".
matplotlib 3.6.x : both cells have separate independent plots
matplotlib 3.7.x: the plot from second cell gets added to the plot of first cell, only one plot as whole is generated. If I try to add this plot to the output tab - the plots completely disappear without any error message.
Versions
jupyterlab: 3.5.x and 3.6.x - didnt make a difference
ipympl: 0.8.x and 0.9.2 - didnt make a difference
I am not sure if this is the right place for this, since this is linked to matplotlib though.
The text was updated successfully, but these errors were encountered: