I am creating radial plots to visualise popularity of a series of topics, I was wondering if someone has come across a radial plot in which the lines originate from the edge of the plot instead of the centre, does anyone know how can this be achieved in R? Are there any good reasons not to do it? Thanks, Gonzalo -- Gonzalo Garcia-Perate PhD candidate, Bartlett School of Architecture, Building, Environmental Design & Planning. University College London. Gower Street, London WC1E 6BT g.garcia-perate at ucl.ac.uk
I guess you have something like this.> testlen <- c(sin(seq(0,1.98*pi,length=100))+2+rnorm(100)/10) > testpos <- seq(0,1.98*pi,length=100) > radial.plot(testlen,testpos,rp.type="p",main="Test Polygon",line.col="blue")(http://addictedtor.free.fr/graphiques/graphcode.php?graph=75) Does this work?> radial.plot(5-testlen,testpos,rp.type="p",main="Test Polygon",line.col="blue",radial.lim=c(0,5),radial.labels=5:0)Tom 2010/10/27 Gonzalo Garcia-Perate <gonzillaaa at gmail.com>:> I am creating radial plots to visualise popularity of a series of > topics, I was wondering if someone has come across a radial plot in > which the lines originate from the edge of the plot instead of the > centre, does anyone know how can this be achieved in R? Are there any > good reasons not to do it? > > > Thanks, > > Gonzalo > > -- > Gonzalo Garcia-Perate > PhD candidate, Bartlett School of Architecture, Building, > Environmental Design & Planning. > University College London. Gower Street, London WC1E 6BT > g.garcia-perate at ucl.ac.uk > > ______________________________________________ > 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. >
On 10/28/2010 07:14 AM, Gonzalo Garcia-Perate wrote:> I am creating radial plots to visualise popularity of a series of > topics, I was wondering if someone has come across a radial plot in > which the lines originate from the edge of the plot instead of the > centre, does anyone know how can this be achieved in R? Are there any > good reasons not to do it? >Hi Gonzalo, This is an interesting suggestion. I suppose it could be done with an "invert" routine that swapped the center coordinates for those of the outer ring of the annular grid for each radial line. I think I have seen something like this to illustrate some sort of genetic information. Yep, down about line 139 in my code you could define xposmax and yposmax if the new argument "invert" was TRUE, then if(invert) { xposmax<-cos(radial.pos[i,])*maxlength yposmax<-sin(radial.pos[i,])*maxlength } if(match("r",rptype,0)) { if(invert) segments(xposmax,yposmax,xpos,ypos, col=linecol,lty=ltype,lwd=lwidth,...) else segments(0,0,xpos,ypos,col=linecol, lty=ltype,lwd=lwidth,...) Untested, but it might do what you want. Jim
Jim, thanks for your reply, it works! but the results are not what I expected. What the code does now is completely reverse the central chart area, so what was coloured before now is white, see here http://www.flickr.com/photos/gonzillaaa/ What I was hoping for, was having the same length lines (very short ones and very long ones) but stemming from the edge of the plot. Any suggestions? Thank you, On 28 October 2010 10:42, Jim Lemon <jim at bitwrit.com.au> wrote:> On 10/28/2010 07:14 AM, Gonzalo Garcia-Perate wrote: >> >> I am creating radial plots to visualise popularity of a series of >> topics, I was wondering if someone has come across a radial plot in >> which the lines originate from the edge of the plot instead of the >> centre, does anyone know how can this be achieved in R? Are there any >> good reasons not to do it? >> > Hi Gonzalo, > This is an interesting suggestion. I suppose it could be done with an > "invert" routine that swapped the center coordinates for those of the outer > ring of the annular grid for each radial line. I think I have seen something > like this to illustrate some sort of genetic information. > > Yep, down about line 139 in my code you could define xposmax and yposmax if > the new argument "invert" was TRUE, then > > if(invert) { > ?xposmax<-cos(radial.pos[i,])*maxlength > ?yposmax<-sin(radial.pos[i,])*maxlength > } > if(match("r",rptype,0)) { > ?if(invert) > ?segments(xposmax,yposmax,xpos,ypos, > ? col=linecol,lty=ltype,lwd=lwidth,...) > ?else > ?segments(0,0,xpos,ypos,col=linecol, > ? lty=ltype,lwd=lwidth,...) > > Untested, but it might do what you want. > > Jim >-- Gonzalo Garcia-Perate PhD candidate, Bartlett School of Architecture, Building, Environmental Design & Planning. University College London. Gower Street, London WC1E 6BT g.garcia-perate at ucl.ac.uk