Unify hovertemplate title cannot be edited.
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
Hello
It seems that we cannot modify the title of the hovertemplate when the chart uses a unify hovermode whenever the axis has not a date type.
Here a short example with 2 scatter plots, the first one with a date axis and the second is linear:
import numpy as np
import pandas as pd
from plotly.subplots import make_subplots
dates = pd.date_range("2022-01-01", "2022-03-01")
values = np.random.randint(0, 10, len(dates))
fig = make_subplots(cols=2)
fig.add_scatter(x=dates, y=values, row=1, col=1)
fig.add_scatter(x=values, y=values, mode="markers", row=1, col=2)
fig.update_traces(hovertemplate="%{y}<extra></extra>")
fig.update_xaxes(row=1, col=1, hoverformat=" ")
fig.update_xaxes(row=1, col=2, type="linear", hoverformat=" ")
fig.update_layout(hovermode="x unified")
fig.show()
If you force the second scatter to be a date type, the hovertemplate title is removed with the workaround hoverformat=" ". However, it only works for date axis.
Here some references/related issues:
https://github.com/plotly/plotly.py/issues/4278
https://community.plotly.com/t/customizing-text-on-x-unified-hovering/39440/18
https://community.plotly.com/t/pass-nothing-or-disable-x-axis-hoverformat/67496
plotly version = 5.18.0
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 plotly 5.18.0 运行所提供的 Python 复现,并比较 date-axis 和 linear-axis 的情况。阅读相关 issue #4278 及链接的社区讨论;完成的标准是:linear axis 上的 unified hover 允许移除或自定义 hovertemplate 标题,而无需强制使用 date axis,并包含回归测试覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- numpy, pandas, python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100