Using different data in ggplot's geom_rug than I use in the rest of the plot

后端 未结 2 1679
轻奢々
轻奢々 2021-01-13 16:57

I am having trouble getting geom_rug to plot some data into an existing plot. Here\'s an example plot, where I am comparing some visit day to the magnitude of some measureme

2条回答
  •  春和景丽
    2021-01-13 17:04

    I would try either this:

    ggplot(test, aes(x = visit, y = mag)) + geom_point() + 
      geom_rug(data=vac, aes(x = visit,y = NULL))
    

    or perhaps a better option this:

    ggplot() + 
      geom_point(data = test,aes(x = visit,y = mag)) + 
      geom_rug(data=vac, aes(x = visit))
    

提交回复
热议问题