How to manually set the color of points in plotly express scatter plots

For that you may use the color_discrete_sequence argument.

fig = px.scatter(df, x="sepal_width", y="sepal_length", color_discrete_sequence=['red'])

This argument is to use a custom color paletter for discrete color factors, but if you are not using any factor for color it will use the first element for all the points in the plot.

More about discrete color palletes: https://plotly.com/python/discrete-color/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)