[R] plot polar coordinates

Thomas Steiner finbref.2006 at gmail.com
Thu Jun 3 21:05:27 CEST 2010

Thank you Greg,

I'll add 180 then.

Thanks for the hint with longer radial.lim arguments it works woderfull.

> The lines function is plotting in Cartesian coordinates, not the polar coordinates.

Is there any (lines) function that plots polar coordinates to an existing plot?

Thank you very much!

2010/6/3 Greg Snow <Greg.Snow at imail.org>:
> It looks like polar.plot does not handle negative lengths, you can preprocess the data and just add 180 degrees to the angles corresponding to negative lengths and then use their absolute values.
> The radial.lim is not ignored, based on the documentation the range is then made pretty (and 100 is apparently prettier than 90), if you pass a longer vector (e.g. c(30,60,90) ) then those exact values will be used.
> The lines function is plotting in Cartesian coordinates, not the polar coordinates.
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow at imail.org
> 801.408.8111
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>> project.org] On Behalf Of Thomas Steiner
>> Sent: Thursday, June 03, 2010 8:09 AM
>> To: r-help at r-project.org
>> Subject: [R] plot polar coordinates
>> Hi,
>> I'd like to plot in in polar coordinates a line which is given as a
>> vector of lengths and angles.
>> library("plotrix")
>> polar.plot(length=c(1,-13,3,-
>> 1),polar.pos=c(20,20,45,55),rp.type="p",line.col="red",lwd=3,clockwise=
>> TRUE,label.pos=seq(30,360,by=30),labels=c("ESE","SSE","S","SSW","WSW","
>> W","WNW","NNW","N","NNE","ENE","E"),radial.lim=c(0,90))
>> lines(seq(0,285,by=15),rep(c(40,60),times=10),col="blue")
>> My questions:
>> a) Why is the radial.lim=c(0,90) ignored?
>> b) Why is there no red line?
>> c) Why is the blue line not "jumping" between two circles of radius 40
>> respectively 60 (The first argument of "line" should be the angle, the
>> second the length.)? Or: which function plots in existing polar plots?
>> (Remark the the polygone is not complete, eg going around)
>> My final goal will be such a plot:
>> http://www.mysundial.ca/tsp/images/sun_chart_50_solar_polar.jpg which
>> is the polar-coordinate version of my wikimedia plot
>> http://commons.wikimedia.org/wiki/File:Sonnenstand.png (made in R, see
>> source)
>> Thanks for hints and help,
>> Thomas
>> PS: I asked a close question last year:
>> http://www.mail-archive.com/r-help@r-project.org/msg64998.html
>> ______________________________________________
>> 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.

More information about the R-help mailing list