plotly / plotly/plotly.py

enable arbitrary formatting on x-axis and y-axis tick labels

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

还没有人认领这个 Issue。

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

描述

Thanks for the awesome work on this project! It is incredibly useful!

I have a feature request. I work for a hedge fund and we want our plotly graphs to follow a standardized format. I am having a hard time through writing a generic formatting function that formats the x-axis and y-axis tick values.

For instance, if you wanted to set the tick axis to be bold and include a "x" at the end, you would need to do something like:

fig.update_layout(
    yaxis = dict(
        tickmode = 'array',
        tickvals = [1, 2, 3],
        ticktext = ["<b>1x</b>", "<b>2x</b>", "<b>3x</b>"]
    )
)

Which is pretty inconvenient because you have to specify the tickvals every time you want to do this.

So I was thinking that it could be a good idea to add something like:
fig.update_xaxis(tick_text_formatter=<function that formats a tick value>)

Thoughts?

Again, thanks for the awesome work!

贡献指南

打开贡献指南

从这里开始

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

调研方向

从公开的入口 fig.update_layout 和 fig.update_xaxis 开始,然后跟踪 x 轴和 y 轴刻度标签的表示方式。定义 formatter 的行为和 API,并考虑测试应如何验证任意格式化,而不要求手动设置 tickvals 和 ticktext。

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

评估

技术栈
plotly, python
领域
data-visualization
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

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