How do I create a categorical scatterplot in R like boxplots?

前端 未结 2 1863
梦毁少年i
梦毁少年i 2021-02-10 00:07

Does anyone know how to create a scatterplot in R to create plots like these in PRISM\'s graphpad:

\"e

2条回答
  •  心在旅途
    2021-02-10 00:34

    If you don't mind using the ggplot2 package, there's an easy way to make similar graphics with geom_boxplot and geom_jitter. Using the mtcars example data:

    library(ggplot2)
    p <- ggplot(mtcars, aes(factor(cyl), mpg)) 
    p + geom_boxplot() + geom_jitter() + theme_bw()
    

    which produces the following graphic:

    enter image description here

    The documentation can be seen here: http://had.co.nz/ggplot2/geom_boxplot.html

提交回复
热议问题