[R-sig-Geo] Load a map png in ggplot2 (workaround for missing world map support in ggmap)
Markus Jenning
markus.jenning at web.de
Tue Oct 22 23:36:50 CEST 2013
Hello everybody,
my professor and I are assembling a handout on the best options for
creating maps in R.
As it looked very up-to-date, I've been considering including a short
tutorial on the ggmap package.
Now, as some of you might have noticed, the ggmap package does not fully
support world maps - you can save empty maps as a png, but you can't use
them directly in a plot, as one would usually do, e.g. with
ggmap(get_map(...)).
Unfortunately, being able to plot data on maps of the whole world is one
of our main priorities.
That's why I'm trying to find out how I could load pngs (or similar image
files) into ggplot and use them as a map to plot on. I know that it's
possible to include background images in ggplot (see e.g. this question on
stackoverflow:
http://stackoverflow.com/questions/16409935/plot-data-over-background-image-with-ggplot).
However, this would only cover importing the image itself, and not
adjusting the x/y axes etc., as it is necessary so I can plot my spatial
data onto the map properly.
Has anyone encountered the same problem, and perhaps found a solution?
I'm looking forward to your ideas.
Please let me know if I've been unclear.
Cheers,
Markus
More information about the R-sig-Geo
mailing list