[R] overlap dot plots with box plots

Peter Ehlers ehlers at ucalgary.ca
Sat May 8 09:08:06 CEST 2010


Looks like you're just missing the 'add=TRUE' argument; see below.

On 2010-05-07 11:07, ADM wrote:
>
> Hi,
>
> I am new in R and would like to dot plot my real data points from different
> categories and put box plot overlapping. To give a feeling of the
> distribution of my data and the real values.
> I managed to that in excel but it takes a lot of time and it makes the
> program crash quite often!
> http://n4.nabble.com/file/n2134530/Excelversion.jpg
>
> I managed to get a box plot and a dot plot of my three categories that look
> like  http://n4.nabble.com/file/n2134530/Rplot_boxplot.jpg
> http://n4.nabble.com/file/n2134530/Rplot_dotplot.jpg
>
> but cannot plot them one on top of the other. Any suggestion would be really
> apreciated!!
>
> I would also like to color only the dots and leave the box plot
> 'transparent' as in the excel version, tips on that are also welcome!
>
> Thanks a lot in advance
>
> ADM

  Maybe something like this:

boxplot(count ~ spray, data = InsectSprays, outpch = NA)
stripchart(count ~ spray, data = InsectSprays,
            vertical = TRUE, method = "jitter",
            pch = 21, col = "maroon", bg = "bisque",
            add = TRUE)

(Setting 'outpch = NA' avoids plotting outliers.)

  -Peter Ehlers



More information about the R-help mailing list