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 -- View this message in context: http://n4.nabble.com/Spider-Plot-color-problem-tp1470323p1470323.html Sent from the R help mailing list archive at Nabble.com.
On 02/06/2010 02:21 AM, 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. >Hi I, If you could provide an example, I will try to determine if the radial.plot function will do what you want. Jim
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>