[R] How to add direction of time to plot.circular()
Jim Lemon
jim at bitwrit.com.au
Tue Feb 17 10:41:24 CET 2009
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
More information about the R-help
mailing list