dipetkov / eems

Estimating Effective Migration Surfaces
GNU General Public License v2.0
102 stars 28 forks source link

Dingbats on pdf output of rEEMS plot #30

Closed rmarquezp closed 5 years ago

rmarquezp commented 5 years ago

Just a small issue: When saving files as pdf, R by default renders circles as characters of the Dingbats font to reduce size. This generates problems when editing pdfs with some vector image programs (e.g. Inkscape and Illustrator), since the dots don't always show up. An easy fix is adding "useDingbats=F" in the pdf command. In the package code this fixed it:

save.graphics <- function(plotpath, plot.params) { if (plot.params$out.png) { bitmap(paste0(plotpath, '%02d.png'), type = 'png16m', res = plot.params$res, height = plot.params$height, width = plot.params$width, units = 'in') } else { pdf(paste0(plotpath, '%02d.pdf'), height = plot.params$height, width = plot.params$width, onefile = FALSE, useDingbats=F) } }

Perhaps future releases could have an argument to chose whether using Dingbats in the eems.plots function?

Thanks!

Roberto

dipetkov commented 5 years ago

Thanks for the suggestion. Instead of adding yet one more explicit argument, I instead added the options to pass extra arguments to bitmap or pdf:

...   Extra parameters passed to the graphics generating functions (bitmap for png and pdf for pdf).

With ... you can pass any of the accepted options to pdf. For example:

## Generate PNG figures with height 9 inches, width 8 inches
## and resolution 600 dots per inch.
eems.plots(mcmcpath = eems_results,
           plotpath = paste0(name_figures, "-output-PNGs"),
           longlat = TRUE,
           plot.height = 8,
           plot.width = 7,
           res = 600,
           out.png = TRUE,
           useDingbats = FALSE)