0.8.9 では問題なく動作したが、0.9.1 では動作しなかった ggplot コードがいくつかあります。
のデータをプロットするつもりでtheDF
、縦線をプロットしたいのはxintercept="2010 Q1."
theGrid
を作成するためだけtheDF
です。
theGrid <- expand.grid(2009:2011, 1:4)
theDF <- data.frame(YrQtr=sprintf("%s Q%s", theGrid$Var1, theGrid$Var2),
Minutes=c(1000, 2200, 1450, 1825, 1970, 1770, 1640, 1920, 1790, 1800, 1750, 1600))
使用されるコードは次のとおりです。
g <- ggplot(theDF, aes(x=YrQtr, y=Minutes)) +
geom_point() +
opts(axis.text.x=theme_text(angle=90))
g + geom_vline(data=data.frame(Vert="2010 Q2"), aes(xintercept=Vert))
繰り返しますが、これは ggplot2 0.8.9 を使用する R 2.13.2 では正常に機能しましたが、ggplot2 0.9.1 を使用した R 2.14+ では機能しません。
回避策は次のとおりです。
g + geom_vline(data=data.frame(Vert=4), aes(xintercept=Vert))
しかし、それは私の問題の良い解決策ではありません。
多分いじることscale_x_discrete
が役立つかもしれませんか?