Hi!
I ploted the results from a questionaire, but I would like to chance some things. I only don't know find how to adjust these things.
I uploaded a photo from the plot.
I would like to;
- reverse the sequence of the questions on de Y-axis
- display the exact percentage in each color bar
- Arrange the subgroups in category from 1 (strongly disagree) to 5 (strongly agree)
Does anybody know a good link where to find this info or can anyone explain how to do this?
Thanks in advance!
#Colours
myColors <- c("darkblue","darkgreen","pink","lightblue","darkred")
#Function
ggplot(data = Plotbehandeling , aes(x =percentage, y = question , fill = category)) + geom_bar(stat="identity", width = 0.7) + scale_fill_manual (values=myColors)
library(tidyverse)
PlotTAQbehandeling <- data.frame(
stringsAsFactors = FALSE,
check.names = FALSE,
question = c("question A","question A", "question A","question A","question A",
"question B","question B","question B","question B","question B",
"question C","question C","question C","question C", "question C",
"question D","question D","question D","question D","question D",
"question E","question E", "question E","question E","question E",
"question F", "question F","question F","question F","question F"),
category = c("strongly disagree","disagree", "neutral","agree","strongly agree",
"strongly disagree","disagree","neutral","agree","strongly agree",
"strongly disagree","disagree","neutral","agree","strongly agree",
"strongly disagree","disagree","neutral", "agree","strongly agree",
"strongly disagree","disagree", "neutral","agree","strongly agree",
"strongly disagree","disagree","neutral","agree","strongly agree"),
responses = c(0,0,2,2,2,0,1,0,1,4,0, 0,0,1,5,2,1,2,1,0,0,0,0,2,4,0,1,1,0,4),
`%` = c(0,0,33.333,33.333,33.333,0,
16.667,0,16.667,66.667,0,0,0,16.667,83.3333,
33.3333,16.667,33.3333,16.667,0,0,0,0,33.3333,
66.667,0,16.667,16.667,0,66.667),
percentage = c(0,0,0.33333,0.33333,0.33333,
0,0.16667,0,0.16667,0.66667,0,0,0,0.16667,
0.833333,0.333333,0.16667,0.333333,0.16667,0,0,0,0,
0.333333,0.66667,0,0.16667,0.16667,0,0.66667))