plotly / plotly/plotly.py

Customize Boxplot hoverinfo

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

还没有人认领这个 Issue。

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

描述

Is it possible to customize the hoverinfo of boxplots? Instead of showing the x-axis value infront of q1, q3, mean, etc..I want to change the value for the 'x-axis on the hover info. I thougt that this is possible with customdata but if I use it only the standard informations are displayed.


import plotly.graph_objects as go

x = ['day 1', 'day 1', 'day 1', 'day 1', 'day 1', 'day 1',
     'day 2', 'day 2', 'day 2', 'day 2', 'day 2', 'day 2']

fig = go.Figure()
meta=[0,1,2,3]
fig.add_trace(go.Box(
    y=[0.2, 0.2, 0.6, 1.0, 0.5, 0.4, 0.2, 0.7, 0.9, 0.1, 0.5, 0.3],
    x=x,
    name='kale',
    marker_color='#3D9970',
    customdata=[0, 0, 0 ,0 ,0 ,0, 1, 1, 1, 1, 1, 1],
    hovertemplate='x:%{customdata}'
))

fig.show(renderer='browser')

I want that in the hovrinfo it says 0 insead of 'day 1' and 1 instead of 'day 2' for example.

Greetz Jan :)

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先使用 go.Box、customdata 和 hovertemplate 重现所提供的 Python 示例。阅读 boxplot 的悬停行为,并确定如何使用自定义值替换 x 轴标签,同时保留 q1、q3 和 mean 信息。完成的标准是示例在悬停文本中为第 1 天显示 0,为第 2 天显示 1。

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

评估

技术栈
python
领域
data-visualization
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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