matplotlib / matplotlib/ipympl

Plot disappears after executing cell second time

オープン
#60 コメント 13 件 リアクション 9 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Jupyter Notebook
スター
1.7k
フォーク
234
PR マージ指標
30日以内にマージされた PR はありません

説明

If I have a plot in a notebook cell, and execute it twice, the plot output disappears. This is not what is expected. For example, using this code in one jupyter notebook cell:

```
%matplotlib widget
import matplotlib.pyplot as plt
```
and this in another cell:

```
x = [0, 1, 2, 3]
y = [0, 1, 2, 3]

plt.plot(x, y)
```

The first time I run this, everything plots fine. But when I execute the second cell twice (or any following calls), the plot disappears. The expected behaviour is that it re-plots (using a different colour). If I then re-run the first cell (with `%matplotlib widget`), and then the second cell again, it works (but this basically just resets the plot).

If I include a plot command in the first cell, then I can re-run the second cell as many times as I want and it works as expected.

This does not happen if I use `%matplotlib inline`. I've tested in both jupyter lab and jupyter notebook. My versions are the following:

```
matplotlib 2.2.2 py36_1 conda-forge
ipympl 0.2.1 py36_0 conda-forge
@jupyter-widgets/jupyterlab-manager
@jupyter-widgets/jupyterlab-manager v0.35.0 enabled OK
```

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、報告されている widget バックエンドと inline バックエンドを使って、JupyterLab と Jupyter Notebook で2つのノートブックセルの例を再現します。プロットセルを繰り返し実行した場合を比較し、backend 選択セルを再実行しなくても widget ベースのプロットが表示されたままになり、期待どおりに再レンダリングされることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
jupyter-notebook, matplotlib, python
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。