matplotlib / matplotlib/ipympl

Nesting into HBox collapses plot width

オープン
#125 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

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

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

説明

Here's another effect of requiring the canvas size explicitly, but somehow isn't visible unless the plot gets dropped into an ipywidgets layout (e.g. by a downstream package).

If the interactive matplotlib is the child of one p-Panel, it's fine. But gets squashed as the child of two p-Panels (regardless of orientation).

Explicitly setting canvas.layout.width fixes it, and propagates to the front-end as expected.

```
from ipywidgets import HTML, HBox, VBox
from matplotlib.figure import Figure
from ipympl.backend_nbagg import Canvas, FigureManager

figure = Figure()
canvas = Canvas(figure)
canvas.manager = FigureManager(canvas, 0)

axes = figure.add_subplot(1,1,1)
HBox([HBox([HTML(''), canvas])])
```

```
HBox([canvas])
```

![](https://i.imgur.com/1QuvzaE.png)
![](https://i.imgur.com/DsKXUXJ.png)

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

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

はじめの一歩

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

調査の方向性

提供された Canvas/FigureManager の再現コードを notebook で開始し、1つの HBox に入れた canvas と、2つの HBoxes にネストした同じ canvas を比較します。canvas のサイズが ipywidgets のレイアウトにどのように伝播されるかを調査します。明示的に canvas.layout.width を設定せずに、ネストした場合でもプロットの幅が維持されれば完了です。

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

評価

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

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

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