skip to Main Content

Since yesterday no more graph appears in the cell output when I run my Python codes written as Jupyter notebook on Visual Studio Code. Instead, only one line of text is displayed. For example :
<IPython.core.display.Javascript object>.

I think I changed something without realizing it in the settings of Visual Studio Code. However, I couldn’t find anywhere how to solve this problem.

I restarted Visual Basic and my computer several times and used different kernels, but nothing changed.

I tried to solve the problem by clicking on "change presentation" left to the cell output and then to elect "image/png" as "mimetype", but I can’t select "image" as it is not in the list of "mimetype".
Example of a cell output where the graph is no longer displayed.

The code was working before this issue.

Thank you very much in advance for your help!

2

Answers


  1. Chosen as BEST ANSWER

    The problem came from the "%matplotlib notebook" statement at the beginning of my code.

    After doing some investigation, it occurred to me that the "%matplotlib notebook" statement is not supported by Visual Studio Code. This statement is used in jupyter notebooks to enable interactive graphics features such as the ability to move a 3D graphic in space with the mouse.

    To solve this problem, just use "%matplotlib widget" instead of "%matplotlib notebook" on Visual Studio Code.


  2. It seems that there’s something wrong with your ipython.

    You can try to reinstall ipython by the following command in terminal:

    pip uninstall ipython
    pip install ipython
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search