Revisit: geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?

后端 未结 1 1648
北恋
北恋 2021-01-25 03:19

Using this data frame, I attempted to create a simple line graph using the following code:

crypto_data<-
  crypto_data %>% gather(Cryptocurrencies, USD_Ex         


        
相关标签:
1条回答
  • 2021-01-25 03:43

    Thanks for the edit suggestion, have found a solution!

    crypto_data <-
    crypto_data %>% gather(Cryptocurrencies, USD_Exchange, -Date)
    ggplot(data=crypto_data) +
    geom_line(aes(x=as.numeric(Date), y = USD_Exchange, colour = Cryptocurrencies)
    

    Just had to make the Date variable (that was a factor variable) numeric...

    0 讨论(0)
提交回复
热议问题