我的印象是,如果我使用 tikz 设备(我今天第一次尝试),那么图形文本将与我的 Latex 文档的其余部分(使用 Knitr / RStudio 生成)中的文本一致。但是,我看到(或试图看到)(有和没有 tikz)在我的图形中是非常小的字体。示例代码来演示:
\documentclass[12pt,a4paper]{article}
\begin{document}
Here is some text
<<eg, dev='tikz', size='normalsize',fig.width=12, fig.height=5, fig.cap="ggplot theme not adjusted", echo=FALSE, message=FALSE, warning=FALSE>>=
require(ggplot2)
ggplot(cars) + geom_histogram(aes(speed), binwidth=1)
@
<<egWithTheme, dev='tikz', size='normalsize',fig.width=12, fig.height=5, fig.cap="ggplot element text size 30", echo=FALSE>>=
ggplot(cars) + geom_histogram(aes(speed), binwidth=1) + theme(text=element_text(size=30))
@
<<increasing dpi, dev='tikz', size='normalsize',fig.width=12, fig.height=5, dpi=300, fig.cap="dpi set to 300", echo=FALSE>>=
ggplot(cars) + geom_histogram(aes(speed), binwidth=1)
@
\end{document}
三个结果图的屏幕截图:
在图形和文档中实现字体大小一致性的推荐方法是什么?
谢谢。