I have an knitr
document with single plot. I want to use the original fonts of R
in the plot except the axis labels which should come from latin modern. I can use latin modern for all the fonts in the plot by tikzDevice
package of R
. But compiling this takes too much time when the data set used for plotting is very big.
OR, Can I use tikzDevice
only for labels and title of the plot?
A summary code is below:
<<setup, include=FALSE, cache=FALSE>>=
library(knitr)
library(tikzDevice)
#opts_chunk$set(dev = 'tikz') # I don't want to use tikzDevice.
opts_chunk$set(dev.args=list(pointsize=12))
@
<<tikzfigure, echo = FALSE, fig.width = 4, fig.height = 4, fig.align = 'center', fig.pos = 'ht', tidy = TRUE>>=
plot(1:5,1:5,xlab=paste0("$\\sum \\beta_i$"))
@
The output:
The plot should stay as the same except the x label
should be
(latin modern font.)
How can I achieve this?
(Note: I asked the question stackoverflow as well, but I think this is the correct place for it. I don't know if this is a problem...)
tikz
but avoidcache=FALSE
. – Fran Jun 21 '20 at 18:58