Plotly express style marker outline


I can’t find a way to style markers in the scatterplots created by




Found on this forum that adding this can activate markers and lines:[0].update(mode=‘markers+lines’)

but Is there a way to style them?

Thank you!

What kind of styling are you wanting to apply?

I’d like to add border to markers. Do you have any suggestion to do that? Thanks!

So today you’ll have to do this:

fig = px.scatter(iris, x="sepal_length", y="sepal_width", color="species")
for t in
    t.marker.line.width = 1
    t.marker.line.color = "black"

but with the next release of plotly (3.9.0) in the next few days, it’ll become as easy as this (long) single statement:

px.scatter(iris, x="sepal_length", y="sepal_width", color="species")\
    .update_traces(dict(marker_line_width=1, marker_line_color="black"))
1 Like

Thank you so much for your quick reply! It worked, and im glad it will be streamlined in a few days!

plotly 3.9.0 is out, which supports this new syntax :slight_smile:

1 Like