I'm using ggplot
in R
to create plots, tikzdevice
to save them and then latex
to compile them in a larger document.
when I create a very simple plot, e.g.
require(ggplot2)
require(tikzDevice)
tikz("test.tikz", height = 4, width = 4)
ggplot(data = data.frame(x = c(1:3), y = c(1:3)), aes(x=x, y=y)) +
geom_point() +
theme(text = element_text(family = "sans", face = "bold"))
dev.off()
While I can change the size and the font face using the element_text
options in theme
, changing the font family doesn't work. I.e. the exported tikz
does not contain the sans-serif command.
How can I export the graphic using sans-serif font for text (and particularly the axis labels)?