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? CheersJannis [[alternative HTML version deleted]]
Checking ?par, " In a layout with exactly two rows and columns the base value of '"cex"' is reduced by a factor of 0.83: if there are three or more of either rows or columns, the reduction factor is 0.66." You should be able to simply set cex to 1/0.83 for a 2x2 layout and by 1/0.66 for larger layouts, in a nw 'par' call after setting mfrow or mfcol. More generally, use the cex value set by mfrow/col: par(mfrow=c(2,2)) par(cex=1/par("cex")) plot(1:10) #Normal size symbols, labels etc.> -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Jannis via > R-help > Sent: 02 August 2017 13:29 > To: r-help at r-project.org > Subject: [R] switch of cex adjustment with mfrow? > > 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? > CheersJannis > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}
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
> use > > par(mfrow=c(2,2), cex = 1)This does work as written. But when I first checked single-call setting, an mfrow change to cex in the same call superseded cex=1; hence my suggestion to use separate calls to par(). Further checking confirms that the result of a call to par is dependent on argument specification order in the call: par(mfrow=c(2,2), cex = 1) par("cex") # 1 par(cex=1, mfrow=c(2,2)) par("cex") # 0.83 This obviously isn't a problem, though as an aside I didn't immediately find any comment on the effect of argument order in ?par. It just means you have to be careful exactly what you specify. It may also mean that for future-proofing against possible changes in par execution order, you might want to use separate calls anyway. Steve Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}}