私は面取りされたボックスプロットを作成しました。今私はプロットに線を追加する必要があります。下のコードではラインが表示されませんでした。親切に私にいくつかの助けを提供してください!ありがとう!geom_vlineは私のボックスプロットでは機能しません
データ:
Year |variable |value
2001 |A |39.605
2001 |A |28.50759
2001 |A |24.8132
2002 |A |10.70765357
2002 |A |7.8676
2002 |A |16.05294712
2003 |A |19.7847
2003 |A |20.21635
2003 |A |29.15491667
2001 |B |50
2001 |B |78
2001 |B |90
2002 |B |35
2002 |B |62
2002 |B |82.5
2003 |B |49.5
2003 |B |60
2003 |B |84
コード:
pp <- ggplot(dta, aes(x=factor(Year),y=value)) +
geom_boxplot() +
facet_grid(variable~.,scales="free_y") +
theme_bw()
pp + geom_vline(xintercept = 2002) #The line didn't show.
pp + geom_vline(xintercept = as.numeric(2002)) #The line didn't show.
pp + geom_vline(xintercept = which(levels(dta$Year) =="2002")) #The line didn't show.
ありがとうございます - ウウェ!あなたの答えは、私がレベル()の機能を理解し、将来的にそれをより良く使うのに役立ちます! – Angel
@Angel私は助けることができてうれしいです。おそらく、あなたは[this](http://stackoverflow.com/help/someone-answers)を検討したいでしょうか? – Uwe