Sorry if this question is duplicated as I am not able to find a solution.
I do have a data frame:
| sample_ids | perc_A | perc_B | perc_C |
|------------|--------|--------|--------|
| sample 1 | 0.75 | 0.18182| 0.42222|
| sample 2 | 0.66667| 0.24747| 0.15823|
| sample 3 | 0.70213| 0.28176| 0.17925|
With this, I would like to plot a 100% stacked and grouped bar chart (as shown below; a similar image taken from GitHub).
Detailed explanation based on the provided figure:
Let's say sample 1 is Apples
, for bar A, 75% will be in dark purple (legend: True_perc_a) while 25% will be in light purple (legend: False_perc_a); for bar B, 18.19% will be in dark green (legend: True_perc_b) while 81.81% will be in light green (legend: False_perc_b); for bar C, 42.22% will be in dark yellow (legend: True_perc_c) while 57.78% will be in light yellow (legend: False_perc_c). The same conditions apply to sample 2 and sample 3.
I was able to process the data to get the true and false perc. For example:
df['perc_A'] = (df['perc_A']*100).round(2)
df['perc_F_A'] = (100 - df['perc_A']).round(2)
However, I have some difficulties to plot the figure.