我遇到以下错误在* .Rnw.log:交互式工作(rkward)ggplot2代码在Lyx/pgfSweave下崩溃 - 请提示!
Error: chunk 3 (label=printgraph)
Error in grid.Call.graphics("L_text", as.graphicsAnnot(x$label), x$x, :
Metric information not available for this family/device
只有在LYX并根据声明
+ scale_y_log10(ylim=c(0.025,5))
在下面的示例代码
:
<<Code, tidy=T, sanitize=TRUE>>=
require(ggplot2)
df.qdf=data.frame(T = c(0 ,1,2 ,0 ,1.5,2.5)
,q.500 = c(0.025,2,1 ,0.025, 4,2 )
,q.025 = 0.5*c(0.025,2,1 ,0.025, 4,2 )
,q.975 = 1.5*c(0.025,2,1 ,0.025, 4,2 )
,Occasion = c( 1,1,1 ,2 , 2,2 )
)
theme_set(theme_bw())
Graph=(qplot(T,q.500,data=df.qdf)
+geom_smooth(aes(ymin=q.025,ymax=q.975)
,data=df.qdf
,stat='identity'
,fill='blue')
+ylab('Response')
+xlab('Time [h]')
+facet_grid(facet=.~Occasion)
) +scale_y_log10(ylim=c(0.025,5))
@
<<printgraph,echo=FALSE,fig=TRUE,width=10,height=7,sanitize=TRUE>>=
print(Graph)
@
在
- 的openSUSE 11.2,
- TeXlive2010,(更新所有已安装截至今日)
- [R版本2.12.1(2010-12-16)SVN修订版53855(x86_64的未知-Linux的GNU)与update.packages( )截至今日,
- LyX的1.6.8(更新的texlive)后重新配置,
- 2010年12月18 pgfSweave作为根据艺辉谢的剧本 ('http://gitorious.org/yihui/lyx-sweave配置/blobs/raw/master/lyx-sweave-config.R') (谢谢Yihui!)
代码正常工作
- 当粘贴在rkward的R-命令窗口。
- 时,我注释掉
+scale_y_log10(ylim=c(0.025,5))
LYX我曾尝试已经
sanitize=TRUE
options(device = function(...) { .Call("R_GD_nullDevice", PACKAGE = "grDevices") })
和
dev.off()
(在http://www.inside-r.org/questions/problems-ggplot-and-pgfsweave建议)
没有这种帮助。 请!
不要觉得太糟糕,关于网格图形的细节可能会非常棘手。直到最近,`tikzDevice`才以稳定的方式处理ggplot2的字符串长度计算。那是在“我以为我修好了”很多次之后。 – Sharpie 2011-01-16 20:20:50