plotly / plotly/plotly.py

Histogram should not prepend any text to axis and hover labels (e.g. "sum of ...")

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

还没有人认领这个 Issue。

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

描述

Split from #2876

We need to localize all texts in our project. So, we can't rely on auto-generated, English labels such as "sum of" or "probability."

Issue

The following code produces the correct chart. However, the auto-generated phrase "sum of" appears in the axis label and hover text.

px.histogram(
    chart_data,
    x="role_name",
    y="total_minutes",
    color="work_type",
    labels={
        # notice here the use of _("") localization function
        "role_name": _("Caregiver role"),
        "total_minutes": _("total minutes"),
        "work_type": _("Type of work"),
    },
)

image

image

Expected outcome

The desired output would be that the y-axis label and hover text would be "total minutes" rather than "sum of total minutes," the latter of which we cannot localize. Specifically, when labels are defined for chart dimensions, the aggregation type ("sum of" in this case) should not be prepended to the text, since the content and data language may not be English.

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 px.histogram 示例及其 labels 参数开始,然后跟踪直方图坐标轴和悬停标签是如何生成的。验证本地化的维度标签(例如“总分钟数”)在两个位置显示时,都不会自动添加聚合短语前缀。

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

评估

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

把新 issue 发到你的邮箱

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