I got the impression that if I used the tikz device (which I am doing for the first time for the first time today), the graphic text will match the text in the rest of the Latex document (generated using Knitr / RStudio). However, what I see (or try to see) (with and without a tix) is a very small font in my graphic. Sample code for demonstration:
\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}
Screenshots of three resulting numbers: 

What is the recommended approach to achieve consistency between the font sizes in the graphics and the document?
Thank.
source
share