clicktoshow not working for annotations on log scale
未关闭
还没有人认领这个 Issue。
bug
P3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
The click event does not seem to be triggered when clicking on an annotated point (even after waiting for the hover text to show up indicating that the point "has been found"). In the example below, the annotation cannot be toggled. With linear axes scaling (dropping the log_x|y and not rescaling x|y=np.log10...) the annotation toggling works as expected.
This bug is probably related to the (forced / unnatural) requirement to rescale the (x,y) coordinates of annotations (see #2580)
x = np.arange(1,5)
df = pd.DataFrame(data={'x':x,'y':x**2,'z':x**3,})
fig = px.line(df,
x='x',
y=['y','z'],
log_x=True,
log_y=True,
)
annotations = []
fig.for_each_trace(
lambda trace: annotations.append(dict(x=np.log10(trace.x[-1]),
y=np.log10(trace.y[-1]),
text=f'({trace.x[-1]:g},{trace.y[-1]:g})',
clicktoshow='onoff',
visible=True,
opacity=0.5,
))
)
fig.update_layout(annotations=annotations,
width=300,
height=300,
)
fig.show()

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行提供的带对数坐标轴的 Python 示例,并将其与线性坐标轴版本进行比较。跟踪注释坐标如何重新缩放,以及 clicktoshow 如何处理对已注释点的点击,同时包括 #2580 中的相关上下文。完成标准是:在对数缩放的图表中点击时注释会切换,且不会导致线性缩放回归。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100