Skip to content

Error bars in px.scatter should inherit color and opacity from markers by default #4353

@rickynilsson

Description

@rickynilsson

Error bars do correctly show with the same color (not opacity) as markers when using categorical data to set the color parameter:

import plotly.express as px
df = px.data.iris()
df["e_plus"] = df["sepal_width"]/100
df["e_minus"] = df["sepal_width"]/40
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
                 error_y="e_plus", error_y_minus="e_minus")

fig.show()
image

However, setting the opacity parameter only changes the opacity of the markers:

fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species",
                 error_y="e_plus", error_y_minus="e_minus", opacity=0.6)

fig.show()
image

And using numerical data to set the color parameter, the error bars will not have the same color as the markers, but instead renders in black:

fig = px.scatter(df, x="sepal_width", y="sepal_length", color="petal_width",
                 error_y="e_plus", error_y_minus="e_minus")

fig.show()
image

Fixing this would be super helpful, since the only current solution seems to be to manually add or update the trace for every single data point to set rgba-values for the error bars. My scatter plot had a few thousand data points, making that a very time consuming for-loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions