[R] How to make nice tiny sized figures on graphic devices producing scalable vector output?

Mikhail Titov mlt at gmx.us
Fri Apr 20 18:10:53 CEST 2012


Hello!

I apologize for the previous e-mail that was unintentionally sent not as a
plain text and was unreadable.

Usually whenever I want a tiny plot, I just create it as is (or even large)
and then downscale it in the end application like LaTeX of MS Word. However,
all these graphic devices like postscript, pdf, win.metafile retain physical
sizes, so it would be natural if I can just insert graphics as is provided
those have proper physical sizes embedded.

The question is what is the best method to create plots in R with their
final physical sizes? I would like to create a good-looking figure by
starting with let’s say win.metafile(“some.emf”, 3.35, 2) .

Of course all defaults will produce something unreadable, so I have to scale
down everything with cex at least, and probably with lwd changes. I’ve tried
something like below. But dashed (and all other) lines are still too thick,
plotting symbols are undistinguishable etc. And in general it looks like a
mess to override all possible values.

Is there a better way to downscale whatever is being plotted on a device?

windowsFonts(Arial=windowsFont("TT Arial"))
cex <- .3
win.metafile("some.emf", 3.35, 2)
    data <- data.frame(y=rep(c("a","b","c"), each=10), x=runif(30))
    bwplot(y~x, data,
           par.settings = modifyList(
           simpleTheme(cex=cex, lwd=cex),
           c(
#               theme.nopadding,
               axis.line=list(lwd=cex))),
           panel=function(...) {
               panel.bwplot(..., pch="|")
#               panel.mean(..., pch=16)
           },
           cex=cex,
           ylab=list(label=expression(bold("my x label")), cex=cex),
           xlab=list(label=expression(bold("my y label")), cex=cex),
           scales=list(fontfamily="Arial", cex=cex),
           horizontal=TRUE)
dev.off()

Mikhail



More information about the R-help mailing list