gpt4 book ai didi

r - 如何在带有 Sweave 的 minipage 中使用 ggplot2 图形?

转载 作者:行者123 更新时间:2023-12-01 11:59:06 26 4
gpt4 key购买 nike

这是我的代码,应该显示彼此相邻的图形,但没有这样做。事实上,sweave 部分没有被解释。

\begin{figure}[h]
\begin{center}
\begin{minipage}[t]{.485\linewidth} %
<<fig=true,echo=false>>=
print(graph2)
@
\newline{\color{red}{\caption{\label{idx}Graph one}}}
\end{minipage}
\hspace{.02\linewidth}
\begin{minipage}[t]{.485\linewidth}%
<<fig=true,echo=false>>=
print(graph2)
@
\newline{\color{red}{ \caption{\label{pb}Graph two}}}
\end{minipage}

\end{center}
\end{figure}

graph1,graph2 只是 qplot 创建的任何给定图形。这两个图在小型页面之外都工作得很好。我知道这个话题已经存在,但不知何故我无法找到解决方案来为其他人工作 one .

另外,我还有一个小问题:阻止 Sweave 生成​​ .eps 和 .pdf 的论点是什么?手册只是说它是默认值。但是我确定我只使用 pdflatex,因此不需要 .eps。

最佳答案

呃,这实际上是作弊,但我在 John 的博客上找到了一个很好的解决方法。它没有使用 minipage,而是通过使用 subfigure 来完成它。 Subfigure 使用 Sweave 没有任何问题。好的!

如果您对此解决方案感兴趣,请查看此 site .我仍然想知道如何使用 minipage 来做到这一点 :)

关于r - 如何在带有 Sweave 的 minipage 中使用 ggplot2 图形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3370645/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com