Re: [R] polar.plot add argument

2012-04-18 Thread Jim Lemon

On 04/18/2012 05:32 PM, Etienne RIFA wrote:

  Hello

I try to create a polar.plot in order to represent some paths. I have one
more information: the signal quality.
I created classes and I used the argument add to superimpose my
different signal
levels.

the result:
http://i180.photobucket.com/albums/x82/zetiem/21.png

Normally, the hotter spots should follow the green path. Despite this, we
can see that the shape of the paths are the same for hot spots but on a
smaller scale.

I think that polar.plot with add argument ignores the scale of the active
plot. I saw that by changing the radius scale (elevation angle). With 0° at
the center, I have the same polar.plot.

But I don't know how to fix it. Have you any ideas?


Hi Etienne,
Without your data I can only guess at what might be going wrong. One 
guess is that you specified explicit values for the radial.lim argument 
in the initial call and then did not do so in the add call. If you 
don't want to send your data, try to create a fake data set that will do 
the same thing. Then I could try to debug it.


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.


Re: [R] polar.plot text labels for data points

2010-05-06 Thread Jim Lemon

On 05/06/2010 03:24 AM, Tali wrote:


Hello All.

I am using polar.plot from the {plotrix} library to visualize individual
coral colonies, dying, growing, etc through time. These coral colonies, that
I visit annually happen to be delineated by a circular plot underwater;
hence polar.plot is the best way to visualize my data. (I.e. This is not
cyclical data that I am plotting.) I am trying to label individual data
points (which correspond to actual coral colonies) with their identifying
tag numbers. I have searched and searched and found no polar.plot with text
labels on data points.

I tried to coerce the text function (code below). But no dice.

D = runif(29,0,7) #Distance from center of circular plot (in
meters)
H = runif(29,0,360)  #Compass heading to center of circular plot (in
degrees)

polar.plot(D, H,rp.type = dots, start = 90, point.col = red)

TagID = 200:228  #Labels of individual coral colonies
text(D,H,TagID)#lame attempt at coercing the text function


Is it possible to add text labels to data points in polar.plot?


Hi Tali,
What a great idea!

radial.labels-function(lengths,radial.pos,units=radians,start=0,clockwise=FALSE,
 labels,adj=NULL,pos=NULL,...) {

 if(units == clock24) radial.pos-pi*(450-radial.pos*15)/180
 if(units == polar) radial.pos-pi*radial.pos/180
 if(clockwise) radial.pos--radial.pos
 if(start) radial.pos-radial.pos+start
 # get the vector of x positions
 xpos-cos(radial.pos)*lengths
 # get the vector of y positions
 ypos-sin(radial.pos)*lengths
 text(xpos,ypos,labels,adj=adj,pos=pos,...)
}

You have now immortalized yourself in the plotrix NEWS file. The next 
version will include this function. Briefly, pass the same lengths, 
pass your polar.pos as radial.pos and set units to polar. The 
other arguments are the same as in radial.plot and text.



Any assistance will help save an endangered species. (Really!)


I hope that the endangered species to be saved is humanity.

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.


Re: [R] polar.plot

2009-11-01 Thread Tony Greig
Jim and John,

Thanks for your replies. I ended up using both suggestions to plot the full
tide series and then overlay the averages for rise and fall in different
colours, which illustrated very well how such parameters can
be misleadings in some cases.

Regards,
Tony



2009/10/31 Jim Lemon j...@bitwrit.com.au

 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



[[alternative HTML version deleted]]

__
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.


Re: [R] polar.plot

2009-10-31 Thread John Kane


--- On Fri, 10/30/09, Tony Greig tony.gr...@gmail.com wrote:

 From: Tony Greig tony.gr...@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]]

__
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.


Re: [R] polar.plot

2009-10-31 Thread Jim Lemon

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.