Zoom in on a map in R

312 Views Asked by At

I've created a map of Cornwall and plotted some lats and longs of sampling locations on it using the code below (for worldHires database).

library(maps)
library(mapdata)
map("worldHires", "uk", xlim = c(-5.8, -4.7), ylim = c(49, 51), col = blue, fill = TRUE)
col2rgb( "blue")
blue <- rgb(0,0,255, max = 255, alpha = 255, names = "blue")
points(LatLong$Long, LatLong$Lat, col = pink, cex = .2)

The map that has been created is really small and when I export as image it is super low res. Is there a way I can make the map larger or higher res? I've tried making a map with the ggmaps tool but I'm struggling to get R to recognise the Google API that I've created so I'm going back to this more basic map.

1

There are 1 best solutions below

0
On

It is important to know that how do you export the map.

The quality of the map will depend on the resolution of the output "device". If that is a very high resolution png file, the result will be better. For instance

png(file="highres.png", width=5000, height=5000)
map("worldHires", "uk", xlim = c(-5.8, -4.7), ylim = c(49, 51), col = blue, fill = TRUE)
dev.off()

will give a better result than the default settings for "png()".