2011-11-10 38 views
2

我遇到一個奇怪的軸文本對齊問題,可以在下面(您可能需要放大圖像上,看問題)上的圖形可以看出奇數理由:爲GGPLOT2軸文本

enter image description here

正如您所看到的,x軸文本遠遠低於刻度線,y軸文本遠離刻度線左側,刻度本身遍佈整個地方......可能會導致這種情況行爲,(可能更重要的是)可以做些什麼來避免這種情況?代碼如下,以及大量的dput()。

ZP6 <- ggplot(TestData, 
aes(x = Mean, y = Value)) 
ZP6 <- ZP6 + geom_point() 
ZP6 <- ZP6 + geom_errorbarh(aes(x = Mean, xmin = Mean - ZMult * SE, 
xmax = Mean + ZMult* SE, height = 0), size = I(1/3)) 
ZP6 <- ZP6 + facet_grid(Category ~ Year, scales = "free", space = "free") 
ZP6 <- ZP6 + scale_x_continuous("Principal Evaluative Dimension", breaks = c(-1, 0, 1)/2) 
ZP6 <- ZP6 + scale_y_discrete(name = "") 
ZP6 <- ZP6 + opts(title = "Mean Ideology by Characteristic") 
print(ZP6) 

可以找到TestData的dput()here

在此先感謝您的幫助!

+1

除了ggplot2以外是否還使用其他軟件包?當我嘗試dget()時,我得到錯誤「結構錯誤」(列表(類別=結構(C(3L,3L,3L,1L,1L,6L,: 對象'類別'未找到' –

+1

我是,但我不知道它是如何導致這個錯誤的,我上傳了一個構成TestData的CSV文件:http://dl.dropbox.com/u/83576/Stack%20Overflow%20Data.csv – isDotR

+2

我_knew_我會閱讀關於這個。這是一個[bug](https://github.com/hadley/ggplot2/issues/221),我相信它是在dev版本中修復的。 – joran

回答

2

正如我在上面的評論中提到的,此行爲是在版本0.8.9中的bug,已在新版本(0.9.0)中修復。