0

So I am working on a mapping project. We have maps near completion -drawn using R base graphics (i.e. plot() ) I am outputting my maps in eps format to best suit publication. However the mapping agency who kindly gave us the data require us include their logo - whihc I have in EPS and jpg formats.

How do I load an eps file into R and then superimpose it on a map have drawn (using base graphics) ?

user2498193
  • 1,072
  • 2
  • 13
  • 32
  • Do you have to use R for this job? It seems other tools might be better suited. – Roland Oct 09 '13 at 13:24
  • I'm open to suggestions! I don't know anything about EPS other then journals like them - have not used them before. I kind of need to draw the plots in R - but if I can edit an EPS after in some other program and stictch in a logo that is fine too – user2498193 Oct 09 '13 at 13:46
  • 1
    Well, there is `ImageMagick` for command line editing and Inkscape if you prefer doing it by hand. – Roland Oct 09 '13 at 14:33

1 Answers1

0

The grImport package can be used to import vector graphics (the .eps logo file) and add the imported graphic to a plot. There are a couple of vignettes with the package that show several examples.

Greg Snow
  • 48,497
  • 6
  • 83
  • 110
  • Thanks Greg.That looks like the job but I am running into a problem - will this work on a Mac. I'm using Rstudio in OSX Mountain Lion Getting this error: PostScriptTrace('"path\Logo Large_eps.eps"') sh: gs: command not found Error in PostScriptTrace("\"Path\Logo Large_eps.eps\"") : status 127 in running command 'gs -q -dBATCH -dNOPAUSE -sDEVICE=pswrite -sOutputFile=/dev/null -sstdout=Logo Large_eps.eps".xml captureLogo Large_eps.eps"' – user2498193 Oct 09 '13 at 17:30
  • The grImport package calls the ghostscript program to do some of the processing. You need to install ghostscript yourself, the error says that grImport cannot find gs (ghostscript) on your computer, possibly because you have not installed it, or if you have installed it then R/grImport needs to be told where it is. I don't know OSX enough to help with how to tell it where it is. – Greg Snow Oct 09 '13 at 17:49