错误:geom_path:每个组仅包含一个观测值。您是否需要调整小组审美?

时间:2019-10-17 09:32:27

标签: r ggplot2 linechart

在执行代码时出错

scorecardData  <- data.frame(
   Date = 
c("05/10/2019","06/10/2019","07/10/2019","08/10/2019","09/10/2019"),
   Incoming.Calls= c(10,20,15,5,7)) 


ggplot(data = scorecardData, aes(x = factor(Date), y = Incoming.Calls)) +
  geom_line()

正在获取错误消息: geom_path:每个组仅包含一个观测值。你需要调整吗 群体审美?

1 个答案:

答案 0 :(得分:0)

您需要设置group = 1 参见here

scorecardData  <- data.frame(
    Date = 
        c("05/10/2019","06/10/2019","07/10/2019","08/10/2019","09/10/2019"),
    Incoming.Calls= c(10,20,15,5,7)) 


ggplot(data = scorecardData, aes(x = Date, y = Incoming.Calls, group = 1)) +
    geom_line()