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
17
votes
1 answer

Justification of multiple legends in ggmap/ggplot2

I am trying to make a map with two legends denoting shape and colour ("Type" and "Org" in the example below), and have the legends inset. I can place the legends, but I would like them to be left justified so that their left edges line up. I can't…
andyteucher
  • 1,393
  • 14
  • 21
17
votes
1 answer

Plotting google map with ggplot in R

I am trying to plot Google map that is queried using RgoogleMaps package and combine it with ggplot. Ultimately, I want to show total population using geom_point, somewhat similar to the picture below however I am trying to concentrate on Montgomery…
Ken
  • 863
  • 3
  • 13
  • 24
16
votes
3 answers

R: Error in get_map()/get_googlemap() from ggmap

I am trying to use GGmap to create a plot of vehicle car crashes by state. The map will have dots which are sized based on the number of car crashes in the state. In particular I am trying to recreate the usa-plot shown in the visualizing clusters…
mrsquid
  • 605
  • 2
  • 9
  • 24
16
votes
2 answers

Plot points outside grid as arrows pointing to data with ggplot2 in R

I am generating maps with world-scale data, and then zooming in to certain regions. On the zoomed-in view, I would like to show that there are other data points outside the bounding box, by putting arrowheads that point from the center of the box to…
beroe
  • 11,784
  • 5
  • 34
  • 79
15
votes
4 answers

Increase the api limit in ggmap's geocode function (in R)

I'm trying to use the geocode function from the ggmaps library in R to get coordinates for specific locations. I'm able to use the function fine so far. The issue I'm running into is that I would like to increase my daily limit from 2,500 to…
L P
  • 311
  • 1
  • 3
  • 10
15
votes
2 answers

Format latitude and longitude axis labels in ggplot

I have a ggplot map, for example: library(ggmap) ggmap(get_map()) I'd like the axis labels to be automatically labeled as N-S / W-E: in the above case, for example, instead of lon -95.4 it should show 95.4°E. I have tried to mess with the scales…
AF7
  • 3,160
  • 28
  • 63
15
votes
1 answer

plot small region of a large polygon map in ggplot2

I have a shapefile which I fortified and plotted in ggplot2 using geom_polygon. How can I plot only a small region of this map? My full map looks fine, but my small region is messed up. Here is a working example: This small shapefile can be…
mindlessgreen
  • 11,059
  • 16
  • 68
  • 113
13
votes
2 answers

ggmap in R - keep google copyright information on cropped map

I was wondering if anyone knows how to keep the google copyright information on maps plotted (with a new scale) by ggmap in R? For example: library(ggmap) library(ggplot2) # download basemap ggmap::register_google(key="xxx") # insert your hey here…
QPaps
  • 312
  • 1
  • 14
13
votes
2 answers

Best method of spatial interpolation for geographic heat/contour maps?

I'd like to use something like ggplot2 and ggmap to produce a heat map of arbitrary values such as property prices per metre squared over a geographic area at a street level (with a high resolution). Unfortunately, the task appears to be rather…
Harold Cavendish
  • 869
  • 10
  • 22
12
votes
1 answer

Google API key error in ggmap even when specifying other source

I've started using the package ggmap after a while again, now I'm encountering a problem when I try to fetch a map using the function get_map. No matter which source I specify, I always get the error Error: Google now requires an API key. See…
telegott
  • 196
  • 1
  • 10
12
votes
1 answer

Plotting streets with ggmap and geom_path

I like to plot streets with ggmap in a specific area. I got the data from osm via the overpass api. It works pretty good for most streets with geom_path. However, some streets are messed up. Any hints are appreciated. Please have a look at…
Birger
  • 1,111
  • 7
  • 17
12
votes
1 answer

Set opacity of background map with ggmap

With ggmap and ggplot and the following code... (non-reproducible, but imho not necessary to understand the problem). map <- get_googlemap(center = c(lon = 10.64, lat = 50.56), maptype = "terrain", source = "google", zoom = 6, language = "de-DE",…
grssnbchr
  • 2,877
  • 7
  • 37
  • 71
12
votes
1 answer

Heatmap plot by value using ggmap

I am attempting to use ggmap to look at education scores by school. I created a coordinate list of all the schools and the individual student scores like so: score lat lon 3205 45 28.04096 -82.54980 8275 60 27.32163…
Pierre L
  • 28,203
  • 6
  • 47
  • 69
12
votes
2 answers

ggmap route finding - doesn't stay on roads

I am trying to map a route using the route() function in ggmap. My problem is that the route doesn't stay on the roads. Is there something that my route_df <- route(origin, destination, structure = "route") code is missing? Or is there an…
cnmillar
  • 327
  • 2
  • 13
12
votes
1 answer

ggmap::get_map doesn't allow the exact specification of my map's corners?

I am using R package ggmap. ?get_map says: location: an address, longitude/latitude pair (in that order), or left/bottom/right/top bounding box My code: library(ggmap) library(mapproj) lat_bottom = 52.33 # bottom latitude of Berlin lat_top …
user2323534
  • 585
  • 1
  • 6
  • 18
1
2
3
66 67