here is some sample data from the dataframe
Country restricted V1% V2%
0 Algeria True 39.575812 60.424188
1 Angola True 56.931682 43.068318
2 Argent False 15.555556 84.4444
I am using a stacked bar chart in order to show 3 values. The V1 and V2 have been normalised as %ges so it is simple to create the basic chart like this:
xx=df.plot(kind="bar", x='Country',stacked=True,figsize=(20,10);
having previously ordered the dataframe
df=conjoint_ag_df.sort_values(['restricted',.Country'], ascending=[False,True])
so as to display it by both country and the true / false value.
That gives me a basic display like this.
What I am trying to do is to arrange for all of the columns with a true value in restricted to have one color pair and those with false to have another color pair - as I am sorting by restricted first this means that the color would change from the former to the latter along the x axis of the graph. I can do this for simple bar charts following this example
Color matplotlib bar chart based on value
and for a single pair of colors using this
xx=_df.plot(kind="bar", x='Country',stacked=True,figsize=(20,10),color=['r','b'])
(Hideous) but I can't work out how to apply a differentiator to the columns to change two color values to two different values based on the True False values.