Search code examples
rplotpostscript

Default font size with postscript device


I am generating eps figures in R using the postscript device, something like this (simplified):

require(extrafont)
#font_import() # I did it only once when installing new fonts
# see http://www.fromthebottomoftheheap.net/2013/09/09/preparing-figures-for-plos-one-with-r/
loadfonts(device = "postscript")
postscript("elev.eps", width = 70/25.4, height = 75/25.4,
           family = "Myriad Web Pro", paper = "special", onefile = FALSE,
           horizontal = FALSE)
barplot(krk$counts, space=0, horiz=T, cex.axis = 0.7)
dev.off()

Now my question is about the font size I am trying to fiddle with using cex.axis, in a clumsy way. I am supposed to have the axis labels in font size 8. Can I somehow tell the postscript device that I want the base font size = 8? I.e. for cex = 1 I want font size = 8. All I found available is the cex parameter, which is relative to something which I don't know how to even get, let alone set...

PS: I tried ?postscript but haven't found the answer


Solution

  • This produced the expected dimunition in font size on my device.

    postscript("elev.eps", width = 70/25.4, height = 75/25.4,
                paper = "special", onefile = FALSE,
               horizontal = FALSE, pointsize=8)
    barplot(1,1, space=0, horiz=T, cex.axis = 0.7)
    dev.off()
    

    enter image description here

    (That image is rotated 90 degrees from how it displays in my pdf-viewer, but I don't think your issue relates to the horizontal argument.)