plotly / plotly/plotly.py

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

Offen
#3,770 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P3
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die bereitgestellte Python-Reproduktion mit plotly.graph_objects.Box auszuführen und die drei Traces zu vergleichen, wobei du dich auf das Zusammenspiel von line.color und fillcolor konzentrierst. Die Korrektur ist vollständig, wenn das Setzen der Linienfarbe eines Box-Plots nicht mehr die standardmäßige Füllfarbe ändert, sodass das erwartete Beispiel funktioniert, ohne fillcolor anzugeben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.