textposition="auto" doesn't show texts for 0 values
Open
Nobody has claimed this yet.
bug
P3
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
import pandas as pd
import plotly.graph_objects as go
df = pd.DataFrame(
{
"A": [5, 0, 7],
"B": [5, 0, 7],
},
index=[1, 2, 3],
)
fig = go.Figure(
data=[
go.Bar(
name="A",
x=df.index,
y=df["A"],
text=df["A"],
textposition="auto",
),
go.Bar(
name="B",
x=df.index,
y=df["B"],
text=df["B"],
textposition="outside",
),
]
)
fig.update_layout(
xaxis_title=None,
yaxis_title=None,
legend_title=None,
)
fig.show()
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
Run the provided Python reproduction with plotly.graph_objects and compare the bar labels produced by textposition="auto" and "outside" for the zero values. Trace the bar-label rendering path responsible for the automatic placement, then verify that zero-value text is displayed consistently with the explicit outside placement.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100