[R] multiple rugs on a single plot

Greg Snow Greg.Snow at intermountainmail.org
Tue Jul 17 18:18:05 CEST 2007


The rug function will take line and position arguments for the location
of the rug plot, so you can do something like:

> rug( x1, line=0 )
> rug( x2, line=1 )
> rug( x3, line=2 )

Where line=0 means right on the x axis, line=1 means 1 textline height
below the x axis (-1 would be the same distance above the x axis).  Or
pos=y  will plot the rug plot at the specified y value (and you can give
it y values below the y-axis).

You should probably make sure to leave enough room for the rug plots to
not be crowded and look at the other graphical options for how the rug
plot will look.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Quin Wills
> Sent: Tuesday, July 17, 2007 4:51 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] multiple rugs on a single plot
> 
> Hi
> 
>  
> 
> I could only find some discussion on this wrt lattice 
> graphics (which I'm not using). Apologies if I'm missing 
> something obvious. 
> 
>  
> 
> I'd like to produce 3 rug plots under a kernel density plot 
> for a population. The population is subdivided into 3 
> subpopulations, which I'd like the rug plots to highlight. 
> Naturally, when I do 3 rug plots, they all plot over each 
> other. I'd like 3 parallel rug plots along the x-axis. But how.
> 
>  
> 
> Thanks in advance,
> 
> Quin
> 
>  
> 
>  
> 
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list