[R] Changing origin of line in radial plot

Gonzalo Garcia-Perate gonzillaaa at gmail.com
Thu Oct 28 13:38:19 CEST 2010


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



More information about the R-help mailing list