我想将y轴缩放为percent.x而不是percent.y。但是,当我这样做时,比例尺是不正确的。
"PID","severity","percentage.x","sideEffectScore","n","percentage.y"
189,"moderate",40,"1",25,69.44
189,"moderate",40,"2",5,13.89
189,"moderate",40,"3",5,13.89
189,"moderate",40,"4",1,2.78
189,"severe",26.67,"1",8,33.33
189,"severe",26.67,"2",9,37.5
189,"severe",26.67,"3",7,29.17
189,"transient",33.33,"1",12,40
189,"transient",33.33,"2",8,26.67
189,"transient",33.33,"3",8,26.67
189,"transient",33.33,"4",2,6.67
library(ggplot2)
df <- read.csv("testing.csv",
header = T)
ggplot(testing, aes(severity, percentage.y)) +
geom_bar(aes(fill = sideEffectScore), stat="identity")
y.y轴的百分比为y的总和为100%。