On 10/31/2009 04:49 AM, Tony Greig wrote:
Hi,

Two questions:

1 - Say I have average speed and directions for tide and I would like to
plot them on a polar plot, but with different colors so I can indicate the
two directions. I'm using polar.plot from the plotrix library. How can I add
a second "b" and "dir.b" series to a polar.plot?

library(plotrix)
a = 3
dir.a = 85
b = 4
dir.b = 250
polar.plot(a, dir.a, start = 90, clockwise = T, show.grid.labels = T,
radial.lim=c(0,5), line.col=2, lwd=2)


2 - Which parameter in polar.plot can I use to set the orientation for the
grid labels which seem to default at 90 in my example above?

Hi Tony,
The first one is easy:

polar.plot(c(a,b), c(dir.a,dir.b), start = 90,
 clockwise = T, show.grid.labels=FALSE,
 radial.lim=c(0,5), line.col=2, lwd=2)

I have had one other person as about an "add" option, and I might include that in a future version. The second one is a bit harder. You probably noticed that I changed the show.grid.labels argument to FALSE in the above.

par(xpd=TRUE)
boxed.labels(rep(0,5),1:5,1:5,border=NA)
par(xpd=FALSE)

This will put the labels vertically up from the center. Doing fancier things like having the labels at an angle would require calculating the positions, which isn't too hard.

Jim

______________________________________________
R-help@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.

Reply via email to