plotly / plotly/plotly.py

ipywidgets GridspecLayout not supported

Open
#2,694 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

import plotly.graph_objects as go

fig = go.FigureWidget(go.Bar(
            x=[20, 14, 23],
            y=['giraffes', 'orangutans', 'monkeys'],
            orientation='h'))

from ipywidgets.widgets import HBox
HBox([fig,fig])

image

from ipywidgets import GridspecLayout
grid = GridspecLayout(1, 2)
grid[1,1]=fig
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-551846bd84cb> in <module>
      1 from ipywidgets import GridspecLayout
      2 grid = GridspecLayout(1, 2)
----> 3 grid[1,1]=fig

/opt/conda/lib/python3.8/site-packages/ipywidgets/widgets/widget_templates.py in __setitem__(self, key, value)
    316         self._id_count += 1
    317         obj_id = 'widget%03d' % self._id_count
--> 318         value.layout.grid_area = obj_id
    319 
    320         rows, columns = self._get_indices_from_slice(row, column)

/opt/conda/lib/python3.8/site-packages/plotly/basedatatypes.py in __setattr__(self, prop, value)
   4978         if match is None:
   4979             # Set as ordinary property
-> 4980             super(BaseLayoutHierarchyType, self).__setattr__(prop, value)

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.

Research direction

Run the supplied Python examples in a Jupyter notebook, comparing the working HBox case with the GridspecLayout assignment that raises ValueError. Trace how the figure widget handles the layout assignment, then verify that placing a FigureWidget in GridspecLayout works without the reported exception.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.