R 使用fun.y ggplot时更改y比例

R 使用fun.y ggplot时更改y比例,r,plot,ggplot2,scale,R,Plot,Ggplot2,Scale,这是我的数据的一个例子 library(ggplot) set.seed(1) df <- data.frame(Groups = factor(rep(1:10, each = 10))) x <- sample(1:100, 50) df[x, "Style"] <- "Lame" df[-x, "Style"] <- "Cool" df$Style <- factor(df$Style) p <- ggplot() + stat_summary(dat

这是我的数据的一个例子

library(ggplot)
set.seed(1)
df <- data.frame(Groups = factor(rep(1:10, each = 10)))
x <- sample(1:100, 50)
df[x, "Style"] <- "Lame"
df[-x, "Style"] <- "Cool"
df$Style <- factor(df$Style)

p <- ggplot() + stat_summary(data = df, aes(Groups, Style, fill = Style),
geom = "bar", fun.y = length, position=position_dodge())
库(ggplot)
种子(1)

df您可以利用
ggplot
分组和柱状图来完成这项工作

p <- ggplot(df, aes(Groups, fill=Style)) + geom_histogram(position=position_dodge())

p非常感谢您!!!不幸的是,我需要15个声望才能给你一个投票权。。。我是个笨蛋。但请知道我有多感激。