ggplot each group consists of only one observation

后端 未结 1 1617
小鲜肉
小鲜肉 2020-12-17 15:37

I\'m trying to make a plot similar to this answer: https://stackoverflow.com/a/4877936/651779

My data frame looks like this:

df2 <- read.table(tex         


        
相关标签:
1条回答
  • 2020-12-17 16:15

    Add group = samples to the aes of geom_line. This is necessary since you want one line per samples rather than for each data point.

    ggplot(df2, aes(measurements, value)) + 
      geom_line(aes(colour = samples, group = samples))
    

    enter image description here

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