Albert Crosby
2008-Jun-04 15:50 UTC
[R] Creating a "simple" Radar/Spider Plot from Statgraphics
I'm new to R - and trying to create a plot similiar to the spider plot at http://www.statgraphics.com/eda.htm#radar . I can't figure out several things... most of which I would think would be straightforward.... How can I change the lines for each series plotted instead of creating a filled area? How can I get the labels for each of the radial axes at the outside of the plot instead of on a small circle in the middle? Is there an easy way to get a legend like the sample plot? Here's my attempt so far, using the USJudgeRating dataset... I'm sure that there's something simple that I'm missing.... stars(USJudgeRatings[1:2,1:9],locations = 0:1, scale=FALSE, draw.segments=FALSE, col.segments=1:5,col.stars=0,key.loc=0:1, main="Radar/Spider Plot\nSee http://www.statgraphics.com/eda.htm#radar",full=TRUE) What I really want to do is plot a dataset like this one: Year Below Basic Proficient Advanced 2005 10 25 30 35 2006 8 21 41 30 2007 15 24 48 14 2008 14 19 42 25 and get a graphic with 4 superimposed stars of different colors superimposed showing the shape of the distribution for each year. The data is percentsges of students scoring in each category, summing to 100. There are actually scores for Literacy and Math, so I might display 8 radii instead of the 4 above. And the dataset/graph would be repeated for comparing various subpopulations. Any pointers would be welcomed! Thanks! Albert Crosby Springdale Public Schools Springdale, Arkansas [[alternative HTML version deleted]]
Dieter Menne
2008-Jun-05 06:19 UTC
[R] Creating a "simple" Radar/Spider Plot from Statgraphics
Albert Crosby <acrosby <at> sdale.org> writes:> > I'm new to R - and trying to create a plot similiar to the spider plot at > http://www.statgraphics.com/eda.htm#radar . > > I can't figure out several things... most of which I would think would be > straightforward.... > > How can I change the lines for each series plotted instead of creating a > filled area? > > How can I get the labels for each of the radial axes at the outside of the > plot instead of on a small circle in the middle? >I have not tried it, but you might check package plotrix, and the examples on http://addictedtor.free.fr/graphiques/thumbs.php?sort=keywords Dieter
Jim Lemon
2008-Jun-05 10:17 UTC
[R] Creating a "simple" Radar/Spider Plot from Statgraphics
Albert Crosby wrote:> I'm new to R - and trying to create a plot similiar to the spider plot at > http://www.statgraphics.com/eda.htm#radar . > > I can't figure out several things... most of which I would think would be > straightforward.... > > How can I change the lines for each series plotted instead of creating a > filled area? > > How can I get the labels for each of the radial axes at the outside of the > plot instead of on a small circle in the middle? > > Is there an easy way to get a legend like the sample plot? > > Here's my attempt so far, using the USJudgeRating dataset... I'm sure that > there's something simple that I'm missing.... > > stars(USJudgeRatings[1:2,1:9],locations = 0:1, scale=FALSE, > draw.segments=FALSE, > col.segments=1:5,col.stars=0,key.loc=0:1, > main="Radar/Spider Plot\nSee > http://www.statgraphics.com/eda.htm#radar",full=TRUE) > > What I really want to do is plot a dataset like this one: > > Year Below Basic Proficient Advanced > 2005 10 25 30 35 > 2006 8 21 41 30 > 2007 15 24 48 14 > 2008 14 19 42 25 > > and get a graphic with 4 superimposed stars of different colors superimposed > showing the shape of the distribution for each year. The data is > percentsges of students scoring in each category, summing to 100. There are > actually scores for Literacy and Math, so I might display 8 radii instead of > the 4 above. And the dataset/graph would be repeated for comparing various > subpopulations. > > Any pointers would be welcomed! >Hi Albert, Try this and it may be what you want: # this just gets your data radplot<-read.table("../radarplot.dat",header=TRUE) library(plotrix) radial.plot(radplot[,2:5],label.pos=c(0,pi/2,pi,3*pi/2),rp.type="p", labels=c("Below","Basic","Proficient","Advanced"),main="Performance") # let the legend extend beyond the plot par(xpd=TRUE) legend(-50,50,radplot[,1],col=1:4,lty=rep(1,4)) par(xpd=FALSE) Jim