different behavior for `.show()` and `.write_image()` with `ticksuffix`/`tickprefix`
Open
Nobody has claimed this yet.
bug
P2
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
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 :
.write_image() output :
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction code in the issue and compare the output from fig.show() with fig.write_image(..., format="png") when tickvals, tickprefix, and ticksuffix are set. Trace the two rendering paths to identify why the axis labels differ; done means both outputs apply the prefix and suffix consistently, with a regression test for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100