>df.to_clipboard(sep=',', index=True)
,Country,Type,Year,Count
0,USA,A,1980,0.54
1,USA,A,1990,0.53
2,USA,A,2000,0.8
3,USA,A,2010,0.81
4,USA,A,2020,0.57
5,USA,B,1980,0.79
6,USA,B,1990,0.67
7,USA,B,2000,0.34
8,USA,B,2010,0.52
9,USA,B,2020,0.29
10,Canada,A,1980,0.91
11,Canada,A,1990,0.84
12,Canada,A,2000,0.85
13,Canada,A,2010,0.98
14,Canada,A,2020,0.81
15,Canada,B,1980,0.57
16,Canada,B,1990,0.61
17,Canada,B,2000,0.87
18,Canada,B,2010,0.16
19,Canada,B,2020,0.43
My objective is make a bar plot in plotly.
I did
import plotly.express as px
fig = px.bar(df, x="Year",y='Count',barmode='group',color="Country",hover_data=["Type"])
fig.show()
I get
I want Type A & Type B to have different colors, and preferable additional separate legend. I tried:
fig = px.bar(cnt, x="Year",y='Count',barmode='group',color=["Country","Type"],hover_data=["Type"])
but this gives error.


