我们说我有这样的代码:
library(ggplot2)
mtcars$cyl <- factor(mtcars$cyl,levels=c(4,6,8),
labels=c("4cyl","6cyl","8cyl"))
data <- mtcars[which(mtcars$gear==3),]
ggplot(data, aes(x = gear, y = vs, fill=cyl))+geom_point()+stat_summary(fun.y=mean,geom="bar",position="dodge",width=0.5)
我可以根据填充中的变量创建刻度,所以我得到x轴刻度标签而不是图例4cyl和6cyl?