Just pass a color parameter to the plot function with a list of colors:
df['group'].plot(kind='bar', color=['r', 'g', 'b', 'r', 'g', 'b', 'r'])
If you want to plot the value
as bars and you also want the group
to determine the color of the bar, use:
colors = {1: 'r', 2: 'b', 3: 'g'}
df['value'].plot(kind='bar', color=[colors[i] for i in df['group']])
You can also use something like:
list(df['group'].map(colors))
Instead of the list comprehension.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…