【发布时间】:2021-11-11 17:26:00
【问题描述】:
我在 R 中有以下数据集:
month =c("January","February","March","April","May","June",
"July", "August" ,"September","October","November","December")
value = seq(1:12)
d = data.frame(month,value);d
ggplot(data = d ,aes(x = month,y=value))+geom_line()
但是当我运行它时,R 会向我报告一条错误消息:
geom_path: Each group consists of only one observation. Do you need to adjust the group
aesthetic?
为什么?我该如何解决这个问题?
【问题讨论】:
-
您的意思是
geom_col()而不是geom_line()或 geom_point。根据数据,x 为“月”时只有一个点 -
我每个月都需要一条线。并且要与点相连。这可能吗?