I am trying to color a scatter plot based on a non-numeric column and display these values in the legend using graph_objects.
My goal is identical behavior to the color options with a column of type str in Plotly Express.
I understand if the column I am using is:
'colorcode':['a', 'b', 'c', 'd']
with
color_map={'a':0, 'b':1, 'c':2, 'd':3}
I can do something like
... color=df['colorcode'].map(color_map)
But the problem with this is that it creates a continuous colorbar as if it were a numerical column. However my goal is the legend to behave identically to if this was done with Plotly Express β with values in the column 'colorcode'
and the corresponding color.
Thanks for the help.