0

When using Jupyter on VS Code, when I add in %matplotlib notebook, the graph would not show at all

When I start to plot without the magic everything is working fine. When graph is not showing after adding %matplotlib notebook, removing the magic will not make the graph reappear. I have to reload the VS code window and restart the kernel.

Wei Bin
  • 19
  • 4
  • Well, one thing in your post is a feature and not a bug. " removing the magic will not make the graph reappear." This is because once you run any `%matplotlib ...` command in a notebook, you switch modes for the backend for all cells. So that is why you need to restart the kernel. No way around that. – Wayne Jun 27 '23 at 14:54

1 Answers1

0

Did you install ipympl and try %matplotlib ipympl or %matplotlib widget, as discussed here?

See here and here and here for more about getting this to work with VS Code. Especially the bottom section of the table there where the results of testing various approaches in VS Code are shown.

Wayne
  • 6,607
  • 8
  • 36
  • 93