在 Rstudio 中 Sweave - pdf 中没有显示图 [英] Sweave in Rstudio -- no plots showing in pdf

查看:10
本文介绍了在 Rstudio 中 Sweave - pdf 中没有显示图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里编织/乳胶新手.我生成常规函数输出没有问题,但图没有显示出来.这是一个基本示例:

Sweave/Latex newbie here. I have no problems generating regular functions outputs, but the plots don't show up. Here's a basic example:

documentclass{article}
egin{document}
SweaveOpts{concordance=TRUE}

<<chunk1>>=
print("Hello World")
boxplot(rnorm(100))
@

end{document}

以及对应的.tex输出:

And the corresponding .tex output:

documentclass{article}
usepackage{Sweave}
egin{document}
input{test2-concordance}

egin{Schunk}
egin{Sinput}
> print("Hello World")
end{Sinput}
egin{Soutput}
[1] "Hello World"
end{Soutput}
egin{Sinput}
> boxplot(rnorm(100))
end{Sinput}
end{Schunk}

end{document}

我正在运行 Rstudio 版本 0.98.501.我使用 Texlive,并在 Windows 和 Linux 上进行了尝试,结果相同.我错过了什么?

I am running Rstudio version 0.98.501. I use Texlive, and tried on both Windows and Linux with the same results. What am I missing?

推荐答案

你需要把 fig=TRUE 放在钩子里.它应该看起来像:

You need to put fig=TRUE in the hook. It should look like:

<<chunk1,fig=TRUE>>=

然后再试一次!!

这篇关于在 Rstudio 中 Sweave - pdf 中没有显示图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆