[R] stars (as fourfold plots) in plot (symbols don't work)

Greg Snow Greg.Snow at imail.org
Mon Jun 8 18:46:35 CEST 2009


Here are 2 useful paths (it's up to you to decide if either is the right path).

The my.symbols function in the TeachingDemos package allows you to create your own functions to create the symbols.

But in this case, you can just use the locations argument to the stars function:

> stars(cbind(1,sqrt(test[,3]), 1, sqrt(test[,3]))/16, locations=test[,1:2],
+ col.segments=c("gray90", "gray"),draw.segments=TRUE, scale=FALSE)

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of maiya
> Sent: Saturday, June 06, 2009 4:03 PM
> To: r-help at r-project.org
> Subject: [R] stars (as fourfold plots) in plot (symbols don't work)
> 
> 
> Hi!
> 
> I have a dataset with three columns -the first two refer to x and y
> coordinates, the last one are odds ratios.
> I'd like to plot the data with x and y coordinates and the odds ratio
> shown
> as a fourfold plot, which I prefer to do using the stars function.
> 
> Unfortunately the stars option in symbols is not as cool as the stars
> function on its own, and now i can't figure out how to do it!
> 
> here's an example code:
> #data
> test<-cbind(c(1,2,3,4), c(1,2,3,4), c(2,4,8,16))
> #this is what I want the star symbol to look like
> stars(cbind(1,sqrt(test[1,3]), 1, sqrt(test[1,3])),
> col.segments=c("gray90", "gray"),draw.segments=TRUE, scale=FALSE)
> #this is what happens when using stars in symbols
> symbols(test[,1], test[,2], stars=cbind(1,sqrt(test[,3]), 1,
> sqrt(test[,3])))
> 
> Can anyone set me on the right path please?
> 
> Maja
> --
> View this message in context: http://www.nabble.com/stars-%28as-
> fourfold-plots%29-in-plot-%28symbols-don%27t-work%29-
> tp23905987p23905987.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> 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.




More information about the R-help mailing list