plotly / plotly/plotly.py

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

Open
#4,678 1 comment 0 reactions 0 assignees View on GitHub

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 :
image

.write_image() output :
test

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.