Interaction Plot in ggplot2

前端 未结 4 1612
情深已故
情深已故 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:38

    If you think you might need a more general approach, you could try function rxnNorm in package HandyStuff (github.com/bryanhanson/HandyStuff). Disclaimer: I'm the author. Disclaimer #2: the box plot option doesn't quite work right, but all the other options are fine.

    Here's an example using the ToothGrowth data:

    p <- rxnNorm(data = ToothGrowth, res = "len", fac1 = "dose", fac2 = "supp", freckles = TRUE, method = "iqr", fac2cols = c("red", "green"))
    print(p)
    

    rxnNorm Demo

提交回复
热议问题