As far as the wind rose plot is concerned, that's not too hard:
df <- data.frame(x = 2 * pi * rbeta(100, shape1 = 2, shape2 = 4))
ggplot(df, aes(x)) +
geom_histogram(aes(y = ..count..), colour = 'orange', binwidth = 0.5) +
coord_polar(theta = "x", start = 2*pi, direction = 1, expand = FALSE)
I think the meta-data that the circular package adds as attributes to
the data frame didn't compute with ggplot(). Simplifying its structure
apparently works, though.
I tried a similar thing with geom_density() but got nothing that
looked like your von Mises plot, so perhaps someone else can provide a
better solution there.
HTH,
Dennis
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
as Dennis pointed out, the attributes make things worse.
try these examples:
histogram :
set.seed(123)
X = rbeta(100, shape1 = 2, shape2 = 4)
X = 2 * pi * X
X = circular(X, type = "angle", units = "radians", rotation = "clock")
X = data.frame(x=unclass(X)) # drop unnecessary attributes
p <- ggplot(X, aes(x = x))
p <- p + geom_histogram(aes(y = ..count..), binwidth=pi/6)
p <- p + coord_polar(theta = "x", start = 2*pi, direction = 1, expand = FALSE)
print(p)
density estimatin:
# use vonmises and convert it into data.frame before calling ggplot2
D <- data.frame(lapply(vonmises[c("x", "y")], as.numeric))
p <- ggplot(D, aes(x, y))
p + geom_line() + coord_polar(theta = "x", start = 2*pi, direction =
1, expand = FALSE) + ylim(-1, max(D$y))
--
Kohske Takahashi <takahash...@gmail.com>
Research Center for Advanced Science and Technology,
The University of Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html