[R] Overlay plot: boxplot and stripchart

David Winsemius dwinsemius at comcast.net
Fri Mar 13 20:20:00 CET 2009


It seems almost too simple. Check to see if stripchart has an add= or  
other argument that lets you overlay charts. It does, so try this:

  boxplot(x$earned ~ x$movie)
  stripchart(x$earned ~ x$movie, vertical=T,data=x, method="jitter",  
add=TRUE, pch=19)

-- 
David Winsemius

On Mar 13, 2009, at 3:03 PM, Aldi Kraja wrote:

> Hi,
> I have a data.frame of this kind:
> x
> obs  movie earned rating
> 1        P1   3.2    xx
> 2        P1   4.2    xx
> 3        P1   5.2    xx
> 4        P1   6.2    xx
> 5        P2   3.5    xx
> 6        P2   6.5    xx
> 7        P2   7.5    xx
> 8        P2   4.5    xx
> 9        P2   4.5    xx
> 10       P3   4.8    x1
> 11       P4   7.3    x2
> 12       P4   3.2    x2
> 13       P4   3.3    x2
> I want to overlay the following boxplot and stripchart. I think that  
> I had seen before in a discussion a thread about stripchart in R  
> (maybe from Dalgaard), but although searching for it I couldn't find  
> it.
>
> boxplot(x$earned ~ x$movie)
> stripchart(x$earned ~ x$movie, vertical=T,data=x, method="jitter",  
> pch=19)
>
> Any suggestions are greatly appreciated, otherwise I have to go to  
> points function.
>
> Thanks,
> Aldi
>
> --
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list