Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用facet_wrap时,同一变量的Errorbar不会有条件地分离_R_Ggplot2_Facet_Errorbar - Fatal编程技术网

使用facet_wrap时,同一变量的Errorbar不会有条件地分离

使用facet_wrap时,同一变量的Errorbar不会有条件地分离,r,ggplot2,facet,errorbar,R,Ggplot2,Facet,Errorbar,我有以下数据集: 我想使用facet并排创建三个条形图。我在R中有以下代码: ggplot(nod.stat, aes(fill=Fix, x=Fix, y=mean)) + geom_bar(stat='identity', position=position_dodge(width=0.9)) + geom_errorbar(aes( ymin=mean-se, ymax=mean+se), position = position_dodge(width = 0.90),

我有以下数据集:

我想使用facet并排创建三个条形图。我在R中有以下代码:

  ggplot(nod.stat, aes(fill=Fix, x=Fix, y=mean)) + 
  geom_bar(stat='identity', position=position_dodge(width=0.9)) + 
  geom_errorbar(aes( ymin=mean-se, ymax=mean+se), position = position_dodge(width = 0.90), width=0.2) +
  facet_wrap(.~variable, scales='free')
但这将继续从相同的修复条件添加所有三个SE,如下图所示:


如何确保每个条只有一个错误条?

每个条似乎有三行数据(使用不同的
se
),因此每个条都有多个错误条。例如,Fix=-,variable=Total结节有3行,有3个不同的
se
s,导致3个条。如果您只希望每个栏有一个错误栏,则必须对数据框进行筛选,使其每个栏只有一行(使用您选择的
se
),谢谢,我将尝试更改数据框格式。谢谢,我删除每个栏额外的两行会有所帮助。这是一个合并错误!