Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textposition="auto" doesn't show texts for 0 values #4686

Open
chaosink opened this issue Jul 23, 2024 · 2 comments
Open

textposition="auto" doesn't show texts for 0 values #4686

chaosink opened this issue Jul 23, 2024 · 2 comments
Labels
bug something broken P3 not needed for current cycle

Comments

@chaosink
Copy link

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()

newplot

@archmoj
Copy link
Contributor

archmoj commented Jul 24, 2024

I'm not sure we should consider this a bug.
Here is a codepen illustrating the graph using plotly.js.
You could use an array to specify desirable textposition as illustrated in this codepen.

@gvwilson
Copy link
Contributor

@chaosink I agree with @archmoj that this is a feature rather than a bug - may I close the issue?

@gvwilson gvwilson assigned gvwilson and unassigned gvwilson Jul 26, 2024
@gvwilson gvwilson added P3 not needed for current cycle bug something broken labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 not needed for current cycle
Projects
None yet
Development

No branches or pull requests

3 participants