plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
15.98k stars 2.53k forks source link

ipywidgets GridspecLayout not supported #2694

Open itsergiu opened 4 years ago

itsergiu commented 4 years ago
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)
gvwilson commented 2 months ago

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

timmysilv commented 1 month ago

Hi, I've hit the same issue as well if that motivates a fix any time soon : ) it should just be propagating the grid-area CSS attribute, although I guess it can be messy/hacky because the plotly Layout is completely unrelated to the ipywidgets layout 😕

timmysilv commented 1 month ago

ps, I now just stick the FigureWidget in an ipywidgets.Box as a workaround. since the layout name conflict is probably a pain, this works fine for me