Hi! Iβm new to plotly and trying to do a stacked graph using data from a csv file.
I found some code that made me happy with the design of this graph (on x axis: No, Yes(made up of three sub sections) but now Iβm having trouble getting the colors of the graph and legend to match up.
Data should look like this rn
Column 1 | Column 2 | Column 3 | Column 4 |
---|---|---|---|
sometimes | yes | ||
rarely | yes | ||
never | no | ||
often | yes | ||
Code:
dff = (df.groupby(
['Food_Taking_YN', 'Food_Taking'])
['Responder_Number'].count().reset_index(drop=0).rename(
columns={'Responder_Number': 'Count'}))
Food_Taking = px.bar(
dff,
x = "Food_Taking_YN",
y = "Count",
color = "Food_Taking",
barmode = "overlay",
)
Thanks!