[R] switch of cex adjustment with mfrow?
Duncan Murdoch
murdoch.duncan at gmail.com
Wed Aug 2 18:16:44 CEST 2017
On 02/08/2017 8:29 AM, Jannis via R-help wrote:
> Dear list members,
>
>
> i am trying to create multiple figures with identical layout (i.e. font sizes etc.) for a publication created with Latex. To do so (i.e. to get identical font sizes) I save all plots as a pdf with widths and heights as they would later appear in the paper (to prevent scaling etc.). My problem now is that I create several multipanel plots with par(mfrow=c(...)) which sometimes changes the cex value. Is there any way (other than using layout() etc which would mean a lot of recoding) to prevent this and have identical point and font sizes and line widths etc throughout all plots? I tried to increase the cex value so that after the reduction by mfrow it is again 1 but I am not sure whether this prevents all resizing and was hoping for an easier way to achive this?
> Any ideas?
The par() help page describes the changes that happen when mfrow or
mfcol are set.
You can specify cex when you set mfrow, e.g. instead of
par(mfrow=c(2,2))
use
par(mfrow=c(2,2), cex = 1)
You could put this in a function to save typing (and allow flexibility).
For example,
setmfrow <- function(nr, nc, cex = 1) {
par(mfrow = c(nr, nc), cex = cex)
}
Then use
setmfrow(2,2)
and set both things at once.
Duncan Murdoch
More information about the R-help
mailing list