Skip to content

%matplotlib ipympl does not allow cell "re-plot" ? #248

Closed
@Mike-HubGit

Description

@Mike-HubGit

Describe the issue

Starting from a fresh notebook/python3 in JupyterLab 2.1.5, with 2 cells [1] and [2] :
[1] :

%matplotlib ipympl
import matplotlib.pyplot as plt

[2] :

plt.plot([1,2,3])

If I run [1] then [2], okay I see the plot.
If I run again [2], I obtain :

[<matplotlib.lines.Line2D at 0x11b33ba90>]

and cannot see the plot.
But if I update [2] like :
[2] :

%matplotlib ipympl
plt.plot([1,2,3])

Then I see the plot again. Weird as it does not work like this with %matplotlib inline or with %matplotlib notebook with Jupiter (not Lab).

Another thing surprizing, adding a "figure" :
[1] :

%matplotlib ipympl
import matplotlib.pyplot as plt

[2] :

plt.figure(1)
plt.plot([1,2,3])

[3] :

plt.figure(1)

Displays a png picture of the plot at the level of cell [3] ...

Versions

 3.7.7 (default, May  6 2020, 04:59:01) 
[Clang 4.0.1 (tags/RELEASE_401/final)]
ipympl version: 0.5.6
jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : 4.7.5
ipython          : 7.16.1
ipykernel        : 5.3.2
jupyter client   : 6.1.6
jupyter lab      : 2.1.5
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.7
traitlets        : 4.3.3
Known nbextensions:
  config dir: /Users/mmyara/.jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
  config dir: /opt/miniconda3/etc/jupyter/nbconfig
    notebook section
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      plotlywidget/extension  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
    tree section
      ipyparallel/main  enabled 
      - Validating: OK
JupyterLab v2.1.5
Known labextensions:
   app dir: /opt/miniconda3/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v2.0.0  enabled  OK
        @jupyterlab/toc v4.0.0  enabled  OK
        @krassowski/jupyterlab-lsp v1.0.0  enabled  OK
        @lckr/jupyterlab_variableinspector v0.5.1  enabled  OK
        jupyter-matplotlib v0.7.2  enabled  OK
        jupyterlab-plotly v4.8.2  enabled  OK
        plotlywidget v4.8.2  enabled  OK

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions