I have a summary statistics from the responses to a questionaire item. Further the summary statistics is by several groups (in this case political parties). I would like to create a net stacked bar plot with centering around the neutral category, which is the 3 level ("Neither disagree nor agree") of the response variable in the data frame.
In particular, my available summary of the responses looks like follows.
Group Strongly Agree Agree Neither disagree or agree Disagree Strongly disagree
NV.A 35.1 43.8 3.69 10.9 7.24
OpenVLD 37.8 19.8 11.30 17.9 13.30
SP.A 24.5 11.1 23.50 19.0 22.10
Groen 18.2 5.7 35.70 13.2 27.20
CD&V 29.2 17.9 12.90 20.4 19.80
Simply to put everything together into one data frame.
plot.data<-data.frame(
response = c(rep("Strongly disagree",5),rep("Disagree",5),
rep("Neither agree nor disagree",5),
rep("Agree",5),rep("Strongly agree",5)),
group = c(rep(c("SP.A","Groen","CD&V","OpenVLD","N-VA"),5)),
percentage = c(23.5,35.7,12.9,11.3,3.69,22.1,27.2,19.8,13.2,7.24,19.0,
13.2,20.4,17.9,10.9,24.5,18.2,29.2,37.8,35.1,11.1, 5.70,17.9,19.8,43.8)
)
My current solution is to simply create a stacked bar chart without centering. Is there a way to achieve the centering of the stacked bar chart?
library(ggplot2)
ggplot(plot.data, aes(x=group, y=percentage, fill=response)) +
geom_bar(stat="identity") +
scale_fill_manual(values=c('#ca0020','#92c5de','#0571b0','#f7f7f7','#f4a582'))+
coord_flip()+
theme_minimal()