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? Thanks, Tony [[alternative HTML version deleted]]
--- On Fri, 10/30/09, Tony Greig <tony.greig at gmail.com> wrote:> From: Tony Greig <tony.greig at gmail.com>> 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?You may be able to set par(new=TRUE) but it looks to me like polar.plot sets the radius for each graph so you would need to come up with a way of dealing with this.> > 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?start ? polar.plot(a, dir.a, start = 90, clockwise = T, show.grid.labels = T, radial.lim=c(0,5), line.col=2, lwd=2) op <- par(new=TRUE) polar.plot(b, dir.b, start = 90, clockwise = T, show.grid.labels = T, radial.lim=c(0,5), line.col=1, lwd=2) par(op) __________________________________________________________________ [[elided Yahoo spam]]
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