Nesting into HBox collapses plot width
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start with the provided Canvas/FigureManager reproducer in a notebook, comparing a canvas in one HBox with the same canvas nested in two HBoxes. Investigate how the canvas size is propagated to ipywidgets layouts; done means the plot keeps its width when nested without explicitly setting canvas.layout.width.
Written by the indexing model from the issue text.
Description
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])


- Dominant language
- Jupyter Notebook
- Stars
- 1.7k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from matplotlib/ipympl
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
matplotlib/ipympl#623 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
matplotlib/ipympl#622 · 13 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
matplotlib/ipympl#612 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
matplotlib/ipympl#611 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
matplotlib/ipympl#609 · 6 comments ·
All issues in matplotlib/ipympl
Similar issues
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·
-
light
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
aemdemos/patients-stryker#253 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
clerk/javascript#9852 ·
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
amponce/archive-movie-browser#165 ·