[R] Spider Plot color problem

Peter Ehlers ehlers at ucalgary.ca
Fri Feb 5 23:54:24 CET 2010


Ioan,

The beauty of R is that you get the code and you can make
(often simple) changes to suit your needs. Attached is
stars1.R which makes a few minor changes to stars() to let you
produce starplots with or without the polygon and with
arbitrary colours for the radii. (This might already exist
in some package whereof I know not.) Allowing the polygon
edges to vary in colour would not be hard (I would replace
the relevant call to polygon() with a suitable call to
segments().)

Example:

stars1(mtcars[, 1:7], key.loc = c(14, 1.5), lwd=2,
     col.radius = c(2,2,2,3,3,4,4), polygon = FALSE)


  -Peter Ehlers


IoanLoft wrote:
> Hi all,
> 
> I have encountered a problem which appears to have defeated my (admittedly
> nascent) R skills. I want to draw a spider plot with many cases (just over
> 300). I am primarily interested in the difference between 4 categories of
> cases, and want to display them as different colors. the col.stars parameter
> does not change the color of the lines (which I'm after), but fills the
> stars in (which I'm not after). I have tried fiddling around with par but
> that only changes the label color.
> 
> I notice in the help file that further arguments can be passed to stars, and
> to see plot.default. I have tried passing col="red" for example, but to no
> avail. 
> 
> so far I have (where x is a dataframe containing 18 variables and 320
> cases):
> 
> stars(x,locations=c(0,0), scale=FALSE, radius=FALSE, key.loc = c(0,0),
> main="title")
> 
> and I haven't got any further than that. It would be great if anyone could
> help.
> 
> Many thanks,
> 
> I

-- 
Peter Ehlers
University of Calgary
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stars1.R
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100205/c1852ae5/attachment.pl>


More information about the R-help mailing list