如何在ggplot2中仅使用stat_summary绘制摘要统计图

我有一个所有x,y值的点图,其中包括每个唯一x值的y值之和的线图。我试图隐藏一般的(x,y)点图,仅显示摘要统计信息的线图。

我尝试删除部分代码,但是不断收到错误消息,指出ggplot()或geom_point()缺少以下美学:x,y。但是,当我将x,y参数作为ggplot()或geom_point()的美观对象时,除了汇总统计信息的图外,它还会绘制总体(x,y)的图

This is the plot I'm getting,but I'd like to only see the line graph of the summary statistics

ggplot(data,aes(x=TRAVEL_YEAR,y=NUM_PAX)) +
  geom_point()+
  stat_summary(fun.y= sum,na.rm=TRUE,geom ='line')+
  stat_summary(aes(label=round(..y..,2)),fun.y=sum,geom="text",size=4,vjust = -1.5,hjust = -.05)
  scale_x_continuous(breaks=2007:2020)
slxxfl0000 回答:如何在ggplot2中仅使用stat_summary绘制摘要统计图

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3158165.html

大家都在问