plotly / plotly/plotly.py

ipywidgets GridspecLayout not supported

未关闭
#2,694 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P3
主要语言
Python
星标
18.8k
派生
2.8k
平均合并
16 小时 26 分钟
30 天内合并 PR
21

描述

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)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

在 Jupyter notebook 中运行提供的 Python 示例,比较可正常工作的 HBox 情况与会引发 ValueError 的 GridspecLayout 赋值。跟踪图形 widget 如何处理布局赋值,然后验证将 FigureWidget 放入 GridspecLayout 中可以正常工作且不会出现所报告的异常。

由索引模型根据 Issue 内容生成。

评估

技术栈
jupyter-notebook, python
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。