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