matplotlib / matplotlib/ipympl
display `print` in callbacks in the notebook
オープン
まだ誰も着手していません。
- 主要言語
- Jupyter Notebook
- スター
- 1.7k
- フォーク
- 234
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
n = 0
def printer(event):
global n
print(f'in event {event}')
n += 1
fig.canvas.mpl_connect('button_press_event', printer)
when run in IPython prints out to stdout on every mouse click. In jlab + ipympl the prints don't show up anywhere I can find...
From https://ipywidgets.readthedocs.io/en/stable/examples/Output%20Widget.html it looks like this can work via:
output = widgets.Output()
display(fig.canvas, output)
n = 0
def printer(event):
global n
with output:
print(f'in event {event}')
n += 1
fig.canvas.mpl_connect('button_press_event', printer)
but I suspect there is a way for this to work automatically....
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue では、fig.canvas.mpl_connect を使用する Python コールバックと、ipywidgets.Output を使った回避策が示されています。まず、ipympl を使用して JupyterLab で不足している print 出力を再現し、IPython と比較します。コールバックを Output コンテキストでラップしなくても、matplotlib のコールバックからの print 出力がノートブックに自動的に表示されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- jupyter, jupyter-notebook, python
- 領域
- data-visualization, frontend
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100