【发布时间】:2018-04-30 10:33:59
【问题描述】:
Picture of how I want the graph to look
我有一个包含以下 3 个变量的数据集:
- 条件,分为 3 个级别:控制、眼睛、相机
- mean_destruction,连续,值范围在 0-10 之间,n=120
- mean_expectation,连续,范围在 0-10,n=120
例如:
df1 <- data.frame(Condition = c(rep('Control', 40), rep('Eyes', 40), rep('Camera', 40)),
mean_destruction = sample(0:10, 120, replace = T),
mean_expectation = sample(0:10, 120, replace = T))
我试图在 ggplot 2 中绘制此图,但失败了。这是我为重现下图所做的众多 ahem 努力之一:
ggplot(data=df1, aes(x= Condition, y=(mean.destruction), fill=(mean.expected)) +
geom_bar(stat="identity", position=position_dodge(), colour="black")))
【问题讨论】:
-
请注意上面的链接,上面是我真正想要实现的目标的图片 - 如果我们仍然手工完成所有事情,本可以在几个小时前完成!
标签: r ggplot2 categorical-data geom-bar