matplotlib / matplotlib/ipympl
(Auto-)Resize plots that start too large
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 1.7k
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the issue
Plots by default are sometimes too large, and the right side is cut off (e.g. when using the sexy Jupyter Lab side-by-side rendering or just using a small screen. Obviously you then want to resize them. However, since the resize handle is at the bottom right, it is also not visible. So the only current solution is to manually change the figure size in the code and re-run until it is visible. Not an ideal solution; sometimes you may not have direct access to the code creating the figure.
Some possible solutions:
- add a horizontal scrollbar (probably would need to be done on the JupyterLab side)
- introduce an auto-resize feature in the ipympl figure toolbar that will automatically resize the figure to the available width when pressed
- auto resize all newly created figures, maybe activatable by an "%ipympl autoresize" magic method
- make the handle location configurable
- scale the entire figure such that all of it is always visible (probably doesn't work too well with manual resizing), just like for inline plots
The current state is rather frustrating.
Example:

## Versions
jupyterlab==3.2.8
jupyterlab-widgets==1.0.2
ipympl==0.8.7
ipywidgets==7.6.5
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.
Research direction
Start by reviewing the ipympl figure toolbar and how JupyterLab renders side-by-side figures. Compare the proposed approaches for making an oversized plot usable, then define the intended resize behavior and verify it in the listed JupyterLab, ipywidgets, and ipympl versions; the issue names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter, jupyter-notebook
- Domain
- data-visualization, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100