plotly / plotly/plotly.py

different behavior for `.show()` and `.write_image()` with `ticksuffix`/`tickprefix`

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

还没有人认领这个 Issue。

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

描述

I noticied two different behavior while using (ticksuffix or tickprefix) and tickvals parameter to update an axis when I want to display or save the graph.

Plotly version : 5.22.0

Reproduction code :

import plotly.graph_objects as go
fig = go.Figure(
    data=[go.Bar(x=[1,2], y=[2,3]),],
    layout=dict(xaxis=dict(tickvals=[1,2],tickprefix='a', ticksuffix='b'))
)
fig.show()
fig.write_image(f"graphs/test.png", format="png")

.show() output :
image

.write_image() output :
test

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 issue 中的复现代码开始,在设置 tickvals、tickprefix 和 ticksuffix 时,比较 fig.show() 与 fig.write_image(..., format="png") 的输出。跟踪两条渲染路径,以确定轴标签为何不同;当两个输出都一致地应用前缀和后缀,并为报告的案例添加回归测试时,即视为完成。

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

评估

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

把新 issue 发到你的邮箱

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