This may seem like a simple question, but I couldn't get any information on the sites I looked at.
In ggplot2
I use text size 7. For some reason I needed to use R's native graphics, but I don't know how to scale the text size to match ggplot2
.
The text size of my axes is:
theme(axis.title = element_text(face="bold", size = 7)
Within plot()
, what value of cex.axis
should I put?
We could get the default ggplot using (theme_bw()$text$size)
-> 11
Font size 7 is then 64% smaller then the default -> 7/11 (in my first answer I used 12).
To scale the font size to match your ggplot2 font size of 7, we could a scaling factor of 0.64
dev.off()
barplot(data$mpg, names.arg = data$cyl,
col = "grey", border = "black",
main = "Title", xlab = "X Axis", ylab = "Y Axis",
cex.names = 0.64,
cex.lab = 0.64,
cex.main = 0.64,
yaxt="n",
xaxt="n")
axis(2, cex.axis = 0.64)
axis(1, cex.axis = 0.64)