1
我需要使用R和GGPLOT2参照线添加到我的密度图。添加geom_hline密度积coord_polar()
因为我用极坐标,这应该在我的情节中间的圆圈。我使用geom_hline(yintercept = .5)
,但当我添加coord_polar()
时,没有线条出现在我的情节中。
这是我的代码。
ggplot(flights_sample2, aes(x = radians, fill = factor(nf, levels = c(8:0)))) +
geom_bar(binwidth = pi/18, position = "fill") +
scale_x_continuous(limits = c(0, 2*pi), breaks = c(0,pi/2, pi, 3*pi/2),
labels = c("N", "E", "S", "W")) +
coord_polar() +
xlim(0,2*pi) +
geom_hline(yintercept = .5)
有什么建议吗?
你举的例子是不可重现。 – 2011-12-26 23:01:41