I am trying to get figures ready for publication, where the journal requires the figures to be a certain width and height and the font size to be 10.
This is my basic structure:
cairo_ps(file = "plot.eps", width = 6.85, height = 9.213)
dotplot(...)
dev.off()
I've tried to force the font size using trellis.par.set
, trellis.device
and setting it with pointsize
in the device itself, but no luck. I can't get to change the font size to be anything than it defaults to. Any ideas?
You could use Cairo
instead. This solution can, however, yield some unexpected results as it seems, for example when changing the dpi
argument when calling Cairo
.
There seems to be some coding problems involved. For example, I have to re-run the code after changing the font size for changes to take effect. Be warned! You might have to tweak it a bit to get the font size you want.
Contrary to the built-in graphics devices, however, this seems to react to changes made by trellis.par.set
. Here is a example with PNG, the same works for me with PDF:
dat <- data.frame(a=1:3, b=1:3)
Cairo(file = "plot.png", type="png", units="in", width = 6, height = 3, dpi=100)
xyplot(b~a, dat)
trellis.par.set("fontsize", list(text=12, points=8))
dev.off()
Compare to:
Cairo(file = "plot.png", type="png", units="in", width = 6, height = 3, dpi=100)
xyplot(b~a, dat)
trellis.par.set("fontsize", list(text=18, points=8))
dev.off()