Switch color in plotly express scatter plot

Hi All,

Is there a way to switch color of below chart.

I would like to have RED color for smokers and Green color for Non-Smokers.

I know this can be acheived using Plotly but is it possible using plotly express.

Thanks in advance.

Kind Regards,
Asif Bhat

You can do this with the color_discrete_map argument, yes. Here is the relevant documentation: https://plotly.com/python/discrete-color/#directly-mapping-colors-to-data-values