【问题标题】:I am trying to create an error bar on only one point in my graph?我试图在我的图表中的一个点上创建一个错误栏?
【发布时间】:2023-01-12 01:29:57
【问题描述】:

我试图在图表中的一个点 (132, 172) 上创建一个错误栏,因为它是唯一对我要显示的内容很重要的一个点。我不确定如何做到这一点,所以这是唯一显示的错误栏。这是我带有传统错误栏的常规代码:

ggplot(weather_data, aes(x = snow.melt.date, y = Speyeria.atalantis)) +
 geom_errorbar(aes(ymin=Speyeria.atalantis-12.09, ymax=Speyeria.atalantis + 12.09), width=.2, position=position_dodge(0.05)) + 
geom_point(color = "grey35") +  
geom_point(aes(x=132, y=172), colour="#00AFBB", shape = 17, size = 2.5) + 
geom_point(aes(x=132, y=176), colour="#FFDB6D") + 
stat_smooth(method = "lm", formula = y ~ x, geom = "smooth", color = "steelblue4", se=FALSE) + 
theme_minimal() +labs(x="Snowmelt Date", y="Emergence Date") +
  stat_regline_equation(label.y = 150.0, aes(label = ..eq.label..) ) + 
ggtitle("Speyeria atalantis")

有什么想法吗?

我找不到关于这个问题的信息,所以我没有尝试太多。我考虑过对我的数据进行分组,然后按组绘制?我试着把箭头放在图表点上而不是错误栏上,但结果不一样。

【问题讨论】:

    标签: r


    【解决方案1】:

    你看过这个帖子吗: Making error bars on one group in bar chart in ggplot2 在错误栏参数中创建一个子集可能对您有用。 也供将来参考以获取代码以显示为代码使用: (```) 打开和关闭。你不需要 () 只需要这个来展示它们 并考虑展示你的图表目前如何出现的图片?

    【讨论】:

      猜你喜欢
      • 2021-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-04
      • 1970-01-01
      • 2013-08-14
      • 1970-01-01
      相关资源
      最近更新 更多