plotly / plotly/plotly.py

[BUG]: deserialization of xrange of box select in figure with multiple subplots broken

未关闭
#5,703 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Description

When you do a box (or lasso) select in a figure with multiple subplots (not the first subplot) the selection x/yrange is not a list/dict but a plain python object.

Image

The gif above was created with this example:

import plotly.graph_objects as go
import solara
from plotly.subplots import make_subplots

def build_figure() -> go.Figure:
	fig = make_subplots(rows=1, cols=2, subplot_titles=("Scatter", "Bar"))
	fig.add_trace(go.Scatter(x=[1, 2, 3, 4, 5, 6], y=[2, 1, 3, 5, 4, 6], name="Series A"), row=1, col=1)
	fig.add_trace(go.Bar(x=["A", "B", "C"], y=[3, 1, 2], name="Series B"), row=1, col=2)
	fig.update_layout(title="FigureWidget example with 2 subplots",)
	return fig

@solara.component
def Page():
	def on_selection(data):
		print("on_select data:", data, flush=True)
	solara.FigurePlotly(build_figure(), on_selection=on_selection)


Steps to reproduce
  1. Create a figure with more than one subplot.
  2. Do a box select in the second subplot.
  3. Observe the data send to on_select.

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先运行使用 plotly.subplots 和 solara.FigurePlotly 提供的 Python 示例,然后检查第二个 subplot 中进行 box 选择时的 on_selection 回调数据。跟踪非第一个 subplot 的 selection x/yrange 是如何被反序列化的。当这些范围以 list 或 dictionary 而不是普通 Python object 的形式到达时,即表示完成。

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

评估

技术栈
python
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
活跃
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

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