matplotlib / matplotlib/ipympl
Displaying a previously created Matplotlib figure in a widget
まだ誰も着手していません。
- 主要言語
- Jupyter Notebook
- スター
- 1.7k
- フォーク
- 234
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I'm trying to find a way to take a figure previously created, and show it inside a widget, _without losing interactivity._
Here's a short version of my approach (which may not be the right one):
```python
fig = plt.figure() # previously created figure
out = widgets.Output()
with out:
display(fig)
# other things happening
display(widgets.HBox([fig.canvas, some_other_fig]))
```
If I first create a figure in the notebook outside of an `Output` widget, and then wish to include it later inside something like an `HBox` next to a second figure, I seem to lose interactivity with the figure (including the nice ipympl zoom interface).
Here is a [nbviewer view](https://nbviewer.jupyter.org/github/thomasaarholt/tests/blob/master/Output%20Example%20Notebook.ipynb) of a MWE notebook I created, download it top right on the window. It's best if one downloads it and runs it since the first figure appears buggy in the nbviewer.
Additionally, and I might create a new issue for this - if I call `fig1` at the end of the notebook, I get an unexpected error. Here I'd expect the regular figure to be shown. The error is `AttributeError: 'NoneType' object has no attribute '_send_event'`.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた Output Example Notebook をダウンロードして実行し、以前作成した figure、Output widget、HBox での動作を再現します。まず、表示された figure とその canvas がどのように処理されるかを追跡し、次に、figure が HBox 内で ipympl の対話性を維持していること、および fig1 を表示しても報告された NoneType エラーが発生しなくなったことを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- jupyter-notebook, matplotlib, python
- 領域
- data-visualization, frontend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100