Skip to content

Box Plot line color changes the fill color as well, unless fill color is specified #3770

@ghost

Description

When setting the line color for a box plot, it also makes the fill color of the box plot the same as the line color (with a different opacity I think). This is the case unless the fill color is set explicitly, but this doesn't help if for example your using a layout template for your colors. In my example below for the expected output I have to use a color picker to get the color of the default theme then put that into the fillcolor argument.

import plotly.graph_objects as go
import plotly.data
from plotly.subplots import make_subplots

data = plotly.data.iris()


fig = make_subplots(rows = 3, cols = 1, shared_xaxes=True)

fig.add_traces([
    go.Box(
            x = data["species"],
            y = data["sepal_length"],
            name = "no line color"
    ),
    go.Box(
            x = data["species"],
            y = data["sepal_length"],
            line = {"color":"black"},
            name = "line color = black"
    ),
    go.Box(
            x = data["species"],
            y = data["sepal_length"],
            fillcolor = "#a4adf8", #shouldnt need to do this
            line = {"color":"black"},
            name = "expected"
    )
], rows = [1,2,3], cols = [1,1,1])

fig

plot

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