Plotly Express Scatter color not showing

i’m trying to plot a scatter plot with this data and i want to show the points as Green when lgbm_vs_truth = “True” and Red when lgbm_vs_truth = “False”. However the plot is showing all black and the legend is also not reflecting lgbm_vs_truth.

    title= 'Sensitivity and Specificity',
    hover_data = ['lgbm_prob','rf_prob','y_truth' , 'instance'],
    color_discrete_map = {"True": "green" , "False":"red"},
    symbol = 'rf_vs_truth',
    width = 800,
    height =800,

The trace marker of the figure is weird as well. it is showing color as array[True,True].

Yes, I’m sorry this is a known issue with PX at the moment: it doesn’t do well with categorical colors on boolean columns. We’ll fix this soon but in the meantime you could stringify that boolean to get things to look right :slight_smile:

Thanks! It is working now after converting the columns from boolean to strings. :smiley:

I know this is an old entry with the “solved” tag, but the issue came up for me and the proposed solution did not work.
I have a pandas dataframe that looks like this:
If I use Plotly Express as

fig=px.scatter(dfLocalized, x='Datetime', y='Count', color='lensQuality')

I get the nice resulting plot:

If I now would like to change the colors, and run:

 fig=px.scatter(dfLocalized, x='Datetime', y='Count', color='lensQuality', color_discrete_sequence=['Green','Red'])

I get

which is wrong. If I follow the previous advice and “stringify” my column:

After running

>>> fig=px.scatter(dfLocalized, x='Datetime', y='Count', color='qualityString', color_discrete_sequence=['Green','Red'])

I still get

Help highly appreciated!