Figure resizing with AnyWidget doesn't work as expected
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
See: https://community.plotly.com/t/plotly-v6-0-figure-resizing-with-ipywidgets/89424
import ipywidgets as widgets
import plotly.graph_objs as go
from ipywidgets import HTML, VBox
fig = go.FigureWidget(data=[go.Scatter(x=[1, 2, 3], y=[4, 5, 6])])
custom_css = """
<style>
.plot-container {
width: 100%;
height: 100%;
}
</style>
"""
fig.add_class("plot-container")
container = VBox(
[fig],
layout=widgets.Layout(
width="500px",
height="600px",
border="solid red",
),
)
display(HTML(custom_css), container)
5.24
6.0
A follow-up:
fig.layout.autosize = True
works, but it is poorly implemented. For example if it is set before displaying fig, it many times does not respect this decision. So I usually set it after display. Still if container size changes, it is not going well on its own and you may need to reset it. Honestly, to me it looks like sending a message through this trait which upon setting it again to same value works, although a Bool trait does not work like that. Ideally we should set this once and javascript behind the scene should observe the container size change automatically.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ファイルやテストは指定されていません。まず、提供された ipywidgets の例をバージョン 5.24 と 6.0 に対して実行し、次に FigureWidget/AnyWidget のリサイズ動作と autosize のフォローアップを調査してください。完了の条件は、図が確実にコンテナを埋め、コンテナのサイズが変わったときに自動的に応答し、再現したケースのリグレッションテストがあることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- jupyter-notebook, python
- 領域
- data-visualization, frontend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100