I\'m currently a beginner in Plotly and have a problem I can\'t seem to solve. I have my plotly stacked bar chart but I don\'t know how to color each individual category. I
I came across this question today because I was trying to define colors for every individual marker and struggling. The answer came from one of the other answers, but that answer said it didn't work for this question, but it did for mine.
Here is a gist with and MRE: https://gist.github.com/bhive01/d4821f6d73ea0f428767d9bb68fdd404
Essentially, rather than define colors with color
and/or colors
, you use marker = list(color = ~color)
. This assumes you have data like mine where every point has a color. This was critical for me because when I used color = ~Hex, colors = ~Hex
the colors were used, but the data got sorted and the colors did not match their correct marker.