I am preparing figures in R for submission to a journal. Required formatting is given in mm (line width = 0.5mm, symbols = 3mm, etc).
I know how to define the figure size in mm, and to manage line width and symbol size with respectively lwd and cex, either in par() or within the plot function. I also found how to convert points to mm. However I don't know how to define line weight, text size, etc. precisely, and not "scaling up" as usual (eg. I want lwd = 0.5mm, not lwd = 1.2 x the default size).
I hope I am clear enough =)
Here is my code :
jpeg(paste('path-to-figure.jpg'), width=15, height=7)
plot(x, y, main = 'TITLE', xlab = "X NAME",ylab = 'Y NAME', ylim = c(0,180), xlim = c(0, 4)pch = 1)
dev.off()
Many Thanks !
Line widths in the standard jpeg, png etc. graphics devices are defined in 1/96 of an inch. See https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/png.html . The same is true for pdf but may vary for other devices. 0.5 mm = 0.5 / 25.4 * 96 = 1.890 96ths of an inch. So you would use lwd = 1.89.
You could also consider using ggplot2 since size within that is in mm anyway.
E.g.
ggplot(my_data, aes(x, y)) + geom_line(size = 0.5)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With