ggplot aes_string with interaction

后端 未结 1 1016
既然无缘
既然无缘 2021-01-17 22:07

Using aes_string makes it easy to construct functions to take parameters to plot:

p <- ggplot(mtcars, aes_string(x=\"mpg\", y=\"wt\", group=interaction(\         


        
1条回答
  •  花落未央
    2021-01-17 22:28

    According to this answer this should work (without quoting the colnames):

    p <- ggplot(mtcars, aes_string(x=x, y=y, group=paste0("interaction(", paste0(interact, 
        collapse =  ", "), ")"))) + geom_point()
    

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