Plot output with ipywidgets formatting incorrectly

Open
#436 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
jupyter-notebook, matplotlib, python
Domain
frontend

Research direction

Run the supplied notebook script with the listed working and broken matplotlib/ipympl versions, then compare the HBox layout and widget formatting. Done means the figure and buttons render correctly together in the HBox under the affected versions.

Written by the indexing model from the issue text.

Description

Describe the issue

I built a small GUI within a notebook and had two figures in an ipywidgets HBox object. the latest version of ipympl made it so I could not have both figures in an HBox and generally disrupted the formatting of the object. I was able to fix the issue by reverting both matplotlib and the ipympl versions.

a short script that generates the broken output is as follows

%matplotlib widget
from IPython.display import display, HTML
display(HTML("<style>.container { width:100%!important;}</style>"))

import ipywidgets as ipy
import matplotlib.pyplot as plt
import numpy as np
out1 = ipy.Output()
b1 = ipy.Button(description = 'button1')
b2 = ipy.Button(description = 'button2')
x = np.linspace(0,7,21)
y = np.sin(x)
with out1:
    fig,ax = plt.subplots()
    ax.plot(x,y)
    
display(ipy.HBox([out1,ipy.VBox([b1,b2])]))

Versions

(working version)

ipympl == 0.5.8
matplotlib == 3.3.3

(broken version)

matplotlib == 3.5.1
Dominant language
Jupyter Notebook
Stars
1.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from matplotlib/ipympl

All issues in matplotlib/ipympl

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.