[R] How to add direction of time to plot.circular()

2009-02-16 Thread Michael Kubovy
Dear r-helpers,

I want to show that time is flowing CCW in the following:

require(circular)
len <- 8
labl <- as.character(c(0, 1, 1, 1, 0, 0, 1, 0))
r <- circular(2*pi* (rep(c(1, 3, 6), each = 200)/len + rnorm(600, 0,  
0.025)))
r.dens <- density(r, bw = 25, adjust = 4, kernel = 'vonmises')
plot(r, shrink = 2.5, axes = FALSE, ticks = FALSE, pch = 1, col =  
'lightblue', stack = TRUE, bins = 12 * len)
axis.circular(at = circular(seq(0, (len - 1) * 2 * pi/len, length.out  
= len)), label = labl)
lines(r.dens, col = 2)

I had imagined a directed arc with a smaller radius than the black  
circle, running from 0 to 315 deg. I also thought that adding a short  
horizontal line at its beginning might be helpful. I would appreciate  
advice on how best to do this or anything else that would provide the  
required information.

_
Professor Michael Kubovy
University of Virginia
Department of Psychology
Postal Address:
P.O.Box 400400, Charlottesville, VA 22904-4400
Express Parcels Address:
Gilmer Hall, Room 102, McCormick Road, Charlottesville, VA 22903
Office:B011;Phone: +1-434-982-4729
Lab:B019;   Phone: +1-434-982-4751
WWW:http://www.people.virginia.edu/~mk9y/
Skype name: polyurinsane





[[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] How to add direction of time to plot.circular()

2009-02-17 Thread Jim Lemon

Michael Kubovy wrote:

Dear r-helpers,

I want to show that time is flowing CCW in the following:

require(circular)
len <- 8
labl <- as.character(c(0, 1, 1, 1, 0, 0, 1, 0))
r <- circular(2*pi* (rep(c(1, 3, 6), each = 200)/len + rnorm(600, 0,  
0.025)))

r.dens <- density(r, bw = 25, adjust = 4, kernel = 'vonmises')
plot(r, shrink = 2.5, axes = FALSE, ticks = FALSE, pch = 1, col =  
'lightblue', stack = TRUE, bins = 12 * len)
axis.circular(at = circular(seq(0, (len - 1) * 2 * pi/len, length.out  
= len)), label = labl)

lines(r.dens, col = 2)

I had imagined a directed arc with a smaller radius than the black  
circle, running from 0 to 315 deg. I also thought that adding a short  
horizontal line at its beginning might be helpful. I would appreciate  
advice on how best to do this or anything else that would provide the  
required information.
  

Hi Michael,
You might find that clock24.plot (plotrix) will do what you want, 
although that is in the conventional clockwise direction. You can 
reverse this by using radial.plot and recreating the clock grid in the 
opposite orientation.


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.