matplotlib / matplotlib/ipympl
Failed to execute 'drawImage' on 'CanvasRenderingContext2D' when Canvas instance is embedded in the ipywidgets layout
オープン
まだ誰も着手していません。
- 主要言語
- Jupyter Notebook
- スター
- 1.7k
- フォーク
- 234
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
For my project, it is required to embed Canvas from the ipympl backend in the ipywidgets Layout or AppLayout.
It worked perfectly with version 0.7.0, but with all newer versions the plot image is not rendered in the canvas with exception in Crome browser: Error setting state: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The HTMLImageElement provided is in the 'broken' state.
The minimum example:
import numpy as np
from matplotlib.figure import Figure
from ipympl.backend_nbagg import Canvas as Canvas, FigureManager
class PlotWidget(Canvas):
__num__ = 0
def __init__(self, **kwargs):
Canvas.__init__(self, Figure(dpi=100, figsize=(6, 5.5)))
self.resizable = False
self.header_visible=False
fig = self.figure
ax = fig.add_subplot(1, 1, 1)
self.lines, = ax.plot(np.linspace(0, 1, 100), np.linspace(0, 1, 100), 'o-', markersize=2, linewidth=2)
manager = FigureManager(self, self.__num__)
self.__num__+=1
self.draw()
import ipywidgets.widgets as widgets
from ipywidgets import AppLayout, Layout
class Layout(AppLayout):
def __init__(self, **kwargs):
AppLayout.__init__(self, **kwargs)
self.center = PlotWidget(**kwargs)
if "pane_widths" not in kwargs:
self.pane_widths = [1, '650px', '0px']
if "pane_heights" not in kwargs:
self.pane_heights = ['0px', '300px', '0px']
app = Layout()
display(app)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ipympl の backend_nbagg Canvas を ipywidgets AppLayout 内で使用する、提供された最小例から始め、Chrome で壊れた画像のエラーを再現します。バージョン 0.7.0 とそれ以降のバージョンで挙動を比較します。埋め込み Canvas に drawImage 例外なしでプロットが描画されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, jupyter-notebook, matplotlib, python
- 領域
- data-visualization, frontend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100