1

I am using python to plot in VS code Jupiter on my Mac. The plot is shown in the Interactive View, while I cannot do more thing like zoom or save in the view. I refer to Python Interactive window(see Plot Viewer)and it says:

Within the Python Interactive window, double-click any plot to open it in the viewer, or select the expand button on the upper left corner of the plot.

Expand Button

Plot Viewer

The expand button is supposed to be shown and open the Plot Viewer, while I don't have the button and there is nothing happen after I double-click the plot. No Button Shows

My test code:

import seaborn as sns

import numpy as np

x = np.random.randn(100)

ax = sns.distplot(x)

Could you please help with my issue? I wonder whether I miss any extension. Thank you very much!

Grylls Leong
  • 11
  • 1
  • 3
  • why don't you have the `distplot` deprecation warning? To get the interactive plot windows I run the script on the command line, it would be better if `ms-toolsai.jupyter-renderers` had the option to show the interactive plot windows instead of rendering a png – rioV8 Mar 18 '22 at 08:26

2 Answers2

1

Default the renderer used in Interactive Python windows uses the PNG renderer.

You can change it to use the TkAgg renderer (external window)

Add %matplotlib to the script

%matplotlib
import seaborn as sns
import numpy as np

x = np.random.randn(100)
ax = sns.distplot(x)

You can use other plot renderers

rioV8
  • 24,506
  • 3
  • 32
  • 49
0

enter image description here

If still does not work please check the version of the Python and Jupyter extensions.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13
  • Thank you for your answer, I find that I didn't have Jupyter Note Render option. My Jupyter version is 1.0.0 and my python version is 3.9.7(condo). Could you please tell me what extension I need if you possible. Thanks again. – Grylls Leong Mar 18 '22 at 08:08
  • @Grylls Leong Very sorry for being late. Have you installed some other jupyter? You need to take the Jupyter which was created by `Microsoft`, and it was bound with `Python` extension. That's means if you have installed `Python` extension, you will not need to install `Jupyter` manually, and the version of Jupyter was `v2022.2.1030672458` instead of `1.0.0`. If you have installed it, please disable or uninstall it. – Steven-MSFT Mar 18 '22 at 09:30
  • @Steven-MSFT When I want to use the interactive python VSC gives a message you have to install Jupyter in the virtual environment – rioV8 Mar 18 '22 at 22:13
  • @rioV8 Sorry, but in normal you only need to install `ipykernel` in the new environment, it will install the related modules, including `jupyter_client` and `jupyter_core`. – Steven-MSFT Mar 21 '22 at 09:40