2

When I plot a map in Rstudio, using the maps package, the map is small and when I try to zoom in it stays small. I was wondering if there is a way to enlarge it.

I use e.d. this script from http://www.molecularecologist.com/2012/09/making-maps-with-r/

library(maps)
library(mapdata)
map("worldHires","Canada”, xlim=c(-141,-53), ylim=c(40,85), col="gray90”, fill=TRUE)

Does anyone know how to enlarge this image or is this just not possible due to lack of enough pixels?

zelite
  • 1,478
  • 16
  • 37
rdatasculptor
  • 8,112
  • 14
  • 56
  • 81

1 Answers1

0

Two things:

  • First, there are a few problems with your code, particularly the " (double quote) characters. Below is the correction:

    map("worldHires","Canada", xlim=c(-141,-53), ylim=c(40,85), col="grey90", fill=T)

  • Second, in answer to your question when I exported the plot from with RStudio as a .pdf and opened the .pdf it is indeed a vector file which you can zoom in and out of as expected. You can specify the default canvas size on export, either from the GUI or using a function like pdf()

Phil
  • 4,344
  • 2
  • 23
  • 33
  • thanks! So it's only possible to enlarge it when exported and not within RStudio? – rdatasculptor Nov 28 '14 at 11:16
  • I couldn't, but then I'm not familiar with the map() function. There might be a way to specify a larger canvas size. Check the arguments the function takes with `?map` – Phil Nov 28 '14 at 11:20
  • Also, if this answer resolves your query, don't forget to mark the question answered! Cheers. – Phil Nov 28 '14 at 11:20
  • I'm having the same problem! There is no zoom argument for the map function. I've put subplots on the map so I need to be able to zoom on the map prior to exporting. Any suggestions? – user3389288 Jan 08 '15 at 18:07
  • @user3389288 I think your best bet is to open a new question, reference this question, and let me know so I can take a look. Please provide a minimal reproducible example so we can replicate your issue. Guidance here: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Phil Jan 09 '15 at 10:38