pythonmatplotlibvisual-studio-codejupyter-notebookmatplotlib-widget

Maplotlib figure not show in vscode jupyter notebook


The matplotlib figure suddenly doesn't display in vscode's jupyter notebook environment, even though I used:

%matplotlib inline

When I plot a figure, e.g.:

data = np.random.randn(1000, 2)
fig, ax = plt.subplots()
ax.scatter(data[:, 0], data[:, 1])
plt.show()

only return followings:

<Figure size 432x288 with 1 Axes>

Here is the versions:

I tried to re-install my vscode and it works, but several days later it happens again.

So if any one knows how to solve it? Thanks!


Solution

  • The answer to Matplotlib plots not showing in VS Code? works. I just needed to change the display mode of jupyter renderer.