`geom_line()` connects points mapped to different groups

后端 未结 1 1433
孤城傲影
孤城傲影 2021-02-06 07:30

I\'d like to group my data based on the interaction of two variables, but only map an aesthetic to one of those variables. (The other variable represents replicates

1条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 08:28

    Your code works if you do the following. I think you had a problem because aes treated "treat" and "replicate" as vectors, so it was equivalent to group = 1.

    ggplot(d, aes(x=x, y=y, colour=treatment, group=interaction(treatment, replicate))) + 
      geom_point() + geom_line()
    

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