Questions tagged [ggmap]

A package for plotting maps in R with ggplot2

is an package that allows for the easy visualization of spatial data and models on top of Google Maps, OpenStreetMaps, or Stamen Maps using .

Resources:

1005 questions
53
votes
4 answers

ggmap Error: GeomRasterAnn was built with an incompatible version of ggproto

I'm using ggmap, and got the error below: Error: GeomRasterAnn was built with an incompatible version of ggproto. Please reinstall the package that provides this extension. I've installed the latest version of both ggmap(2.6.1) and ggplot2(2.2.0),…
dingding
  • 531
  • 1
  • 4
  • 4
39
votes
3 answers

How to put a geom_sf produced map on top of a ggmap produced raster

I tried the following code: library(ggplot2) library(ggmap) library(sf) nc <- st_read(system.file("shape/nc.shp", package = "sf")) str(nc) Classes ‘sf’ and 'data.frame': 100 obs. of 15 variables: $ AREA : num 0.114 0.061 0.143 0.07 0.153…
user1453488
  • 441
  • 1
  • 4
  • 4
37
votes
4 answers

Plot coordinates on map

I am trying to plot my coordinates using R. I have tried already to follow different post (R: Plot grouped coordinates on world map ; Plotting coordinates of multiple points at google map in R) but I am not having much success with my data. I am…
flacchy
  • 511
  • 1
  • 6
  • 9
29
votes
4 answers

World map with ggmap

I am using ggmap and wish to have a map of the world centered on Australia to which I can easily plot geocoded points. ggmap seems to be a lot easier to use compared to some of the other mapping packages. Yet when I bring through a map using the…
dom_oh
  • 867
  • 2
  • 11
  • 21
28
votes
5 answers

locator equivalent in ggplot2 (for maps)

Note: This question is specific for mapping but I'd like to be able to use it when I plot in a standard Cartesian coordinate system. I love base graphics but also like ggplot2 for many things. One of my most used base functions for fine tuning a…
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
26
votes
3 answers

Error in get_map using ggmap in R

About 90% of the time, when using get_map in ggmap, I get the following error. Can someone please tell me why? map <- get_map(location = 'Australia', zoom = 4) Error in download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") : …
user2861089
  • 1,205
  • 4
  • 22
  • 44
20
votes
2 answers

Getting a map with points, using ggmap and ggplot2

I want a map with points (and other geom_* layers) on it. I get the map, but instead of the points all I get is a warning: Message d'avis : Removed 3 rows containing missing values (geom_point). Here is a reproducible…
Costin
  • 2,699
  • 5
  • 25
  • 43
20
votes
1 answer

Polygons nicely cropping ggplot2/ggmap at different zoom levels

I am playing with a spatial data set (mostly polygons over an area of a city) and I would like to produce different views, based on different levels of zoom. Everything is fine when I have the plot boundary box larger than the area that contains the…
Pascal
  • 395
  • 3
  • 9
19
votes
5 answers

Plot circle with a certain radius around point on a map in ggplot2

I have a map with the 8 points plotted on it: library(ggplot2) library(ggmap) data = data.frame( ID = as.numeric(c(1:8)), longitude = as.numeric(c(-63.27462, -63.26499, -63.25658, -63.2519, -63.2311, -63.2175, -63.23623, -63.25958)), …
Shark167
  • 581
  • 1
  • 8
  • 16
19
votes
1 answer

Making a zip code choropleth in R using ggplot2 and ggmap

I am trying to make a choropleth of very simple data, and it's kind of a pain in the neck. I have the following zip codes in the Eastern USA. This is made up data but you get the idea. Zip Freq 11101 10 10014 15 11238 400 etc. for about…
garson
  • 1,505
  • 3
  • 22
  • 56
19
votes
2 answers

Is there a way to add a scale bar (for linear distances) to ggmap?

Not that it's critical to my question, but here is my plot example, on top of which I'd like to add a scale bar. ggmap(get_map(location = "Kinston, NC", zoom = 12, maptype = 'hybrid')) + geom_point(x = -77.61198, y = 35.227792, colour = "red", size…
doorguote
  • 413
  • 1
  • 6
  • 14
18
votes
3 answers

Plotting static base map underneath a sf object

I'm trying to plot a static base map underneath my sf object (for print). When using ggmap I first get a lot of errors, then I can't seem to figure out how to chain the base map to my ggplot2 object with a geom_sf. library(sf) #…
Tdebeus
  • 1,519
  • 5
  • 21
  • 43
18
votes
4 answers

Get Map with specified boundary coordinates

I want to get a map with RgoogleMaps from R, with a specific coordinates boundary. What I can call is GetMap, and specify a center, I must add a zoom level. Everything works fine, except that I am not getting an image map bounded with the…
lbedogni
  • 7,917
  • 8
  • 30
  • 51
18
votes
2 answers

Administrative regions map of a country with ggmap and ggplot2

I can make USA state level unemployment graph with the following code. library(XML) library(ggplot2) library(plyr) library(maps) unemp <- readHTMLTable('http://www.bls.gov/web/laus/laumstrk.htm', colClasses = c('character', 'character',…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
17
votes
3 answers

Determining the distance between two ZIP codes (alternatives to mapdist)

I want to calculate the distance between approx. 100,000 different ZIP codes. I know about the mapdist function in the ggmap package mapdist works perfectly: library(ggmap) mapdist('Washington', 'New York', mode = 'driving') # from to…
majom
  • 7,863
  • 7
  • 55
  • 88
1
2 3
66 67