Mikhail Titov
2012-Apr-20 16:06 UTC
[R] How to make nice tiny sized figures on graphic devices producing scalable vector output?
Hello! 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 [[alternative HTML version deleted]]
Mikhail Titov
2012-Apr-20 16:10 UTC
[R] How to make nice tiny sized figures on graphic devices producing scalable vector output?
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