panuffel
panuffel

Reputation: 684

How to prevent tikzDevice from scales font size for multi panel plots

For multi panel plots obtained through mfrow or layout, tikzDevice scales the font when I have more than 3 subplots. Is there a possibility to avoid this?

Here's a minimal example:

tikz("fontsize-normal.tikz", width=5, height=2)
plot(1, xlab="my text")
dev.off()

tikz("fontsize-small.tikz", width=5, height=6)
par(mfrow=c(3,1))
plot(1, xlab="my text")
plot(1, xlab="my text")
plot(1, xlab="my text")
dev.off()

In the resulting .tikz-Code for the first plot the text-scaling is fine

\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale=  1.00]
at (192.68, 15.60) {my text};

In the second plot it scaled the node size

\node[text=drawColor,anchor=base,inner sep=0pt, outer sep=0pt, scale=  0.66]
at (188.60,299.38) {my text};

Thanks for your help!

Upvotes: 1

Views: 537

Answers (1)

ToJo
ToJo

Reputation: 1449

Even though a little late, par(mfrow=c(3,1), cex=1) should to the trick.

As you use par with the mfrow argument, the scaling (cex in R) does not equal the defaul value of 1.

"cex - A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. This starts as 1 when a device is opened, and is reset when the layout is changed, e.g. by setting mfrow." (check ?par in R or look here)

Upvotes: 1

Related Questions