Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.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
R ymax和ymin值(在错误栏中)未显示在geompoint中_R_Ggplot2_Errorbar - Fatal编程技术网

R ymax和ymin值(在错误栏中)未显示在geompoint中

R ymax和ymin值(在错误栏中)未显示在geompoint中,r,ggplot2,errorbar,R,Ggplot2,Errorbar,我试图用4个变量(数量、勘探、大小、来源)的平均值、最大值和最小值绘制一张图表,但引用ymax和ymin(错误条)的行不会出现。 这4个变量是重复的,因为它出现在海洋和淡水数据中 我还想通过将变量名称放在y轴的est列中,将平均值放在x轴上,来反转图形轴 有人知道我脚本的错误吗 Dataset在您的代码中,在geom_errorbar中有width=0,这就是您无法看到错误条的原因。此外,您应该编写coord\u flip()。通过这些修改,您的代码应该可以工作: ggplot(Dataset

我试图用4个变量(数量、勘探、大小、来源)的平均值、最大值和最小值绘制一张图表,但引用ymax和ymin(错误条)的行不会出现。 这4个变量是重复的,因为它出现在海洋和淡水数据中

我还想通过将变量名称放在y轴的est列中,将平均值放在x轴上,来反转图形轴

有人知道我脚本的错误吗


Dataset在您的代码中,在
geom_errorbar
中有
width=0
,这就是您无法看到错误条的原因。此外,您应该编写
coord\u flip()
。通过这些修改,您的代码应该可以工作:

ggplot(Dataset,aes(x=est,ymin=min, ymax=max, y=mean, shape=est)) +
  geom_errorbar(aes(ymin=min, ymax=max), color="black") + 
  geom_point(aes(size=1)) +
  guides(size=FALSE,shape=FALSE) + scale_shape_manual(values=c(20, 20, 20, 20)) +
  theme_classic() + xlab("Levels") + ylab("confident interval") +
  coord_flip()
但是,您可以使用其旋转版本
geom\u errorbarh
,而不是
geom\u errorbarh
。因此,无需反转轴,
est
变量可以直接指示为y轴

ggplot(aes(mean, est, label = origen), data=Dataset) +
  geom_point() +
  ggrepel::geom_text_repel() +
  geom_errorbarh(aes(xmin=min, xmax=max)) + 
  theme_classic() + 
  xlab("confident interval") +
  ylab("Levels")

非常感谢您的回答。但是,当删除宽度=0时,出现的是垂直条,而不是指ymax和ymin的条,该条应水平显示(在geom_errorbar的情况下)。因此,图片继续,没有这个错误栏