ggplot中带有抖动的错误条未对齐

时间:2019-10-15 22:19:50

标签: r

当我在标准ggbarplot代码中添加“抖动”时,误差线突然四处移动(未对齐)。我不知道为什么增加抖动会以奇怪的方式取代误差线。

请参阅barplot issue with jitterfine without jitter

专门为ggbarplot添加抖动几乎没有。我怀疑它与负值(从-4到2)或位置闪避有关。

library("ggplot2")
library("ggpubr")
library("grid")
library(magrittr)
library(ggplot2)
library(ggpubr)
library(tidyverse)

dat1$new <- as.factor(dat1$new) 
dat1$index <- as.numeric(dat1$index)

p1<-ggbarplot(dat1, x = "new", y = "index", 
          fill = "new", alpha=.7,
          add = c("mean_ci", "jitter"),
          position = position_dodge(0.8))+theme_classic()+
  ylab("Mean Difference in Judgments")+
  theme(axis.title.x=element_blank(), axis.title.y = element_text(size = 13),
        axis.text.x=element_blank())+ 
  scale_fill_discrete(name = "Group", 
                      labels = c("Treatment", "Control"))+
  theme(legend.text=element_text(size=rel(1.1)))
p1

除了添加“抖动”时(抖动正确显示,但误差线已消除)之外,此方法工作正常,但是根据文档,这应该是“正确的”吗?

非常感谢您的帮助!

0 个答案:

没有答案