我在 *.Rnw.log 中遇到以下错误:
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 rev 53855 (x86_64-unknown-linux-gnu) 与 update.packages() 截至今天,
- LyX 1.6.8(TeXLive 更新后重新配置),
- 2010 年 12 月 18 日的 pgfSweave 根据 Yihui Xie 的脚本配置('http://gitorious.org/yihui/lyx-sweave/blobs/raw/master/lyx-sweave-config.R')(谢谢 Yihui!)
代码工作正常
- 当粘贴在 rkward 的 R 命令窗口中时。
- 在 lyx 中,当我注释掉
+scale_y_log10(ylim=c(0.025,5))
我已经试过了
sanitize=TRUE
options(device = function(...) { .Call("R_GD_nullDevice", PACKAGE = "grDevices") })
和
dev.off()
(建议在http://www.inside-r.org/questions/problems-ggplot-and-pgfsweave)
这些都没有帮助。请!