Interaction Plot in ggplot2

前端 未结 4 1599
情深已故
情深已故 2020-12-28 16:16

I\'m trying to make interaction plot with ggplot2. My code is below:

library(ggplot2)
p <- qplot(as.factor(dose), len, data=ToothGrowth, geom         


        
4条回答
  •  被撕碎了的回忆
    2020-12-28 16:52

    a much easier way. without ddply. directly with ggplot2.

    ggplot(ToothGrowth, aes(x = factor(dose) , y=len , group = supp, color = supp)) + 
      geom_boxplot() +
      geom_smooth(method = lm, se=F) +
      xlab("dose") +
      ylab("len")
    

提交回复
热议问题