From the course: Data Visualization in R with ggplot2
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Plotting points on a map
From the course: Data Visualization in R with ggplot2
Plotting points on a map
- [Instructor] Now that you know how to pull up maps using ggmap and how to geocode points, let's combine these two tasks and begin plotting data points on a map. I already have the code loaded here to geocode a couple of points. Let me go ahead and geocode the location of New York, New York, and also the location of the United States. Now let's use one of those points to pull up a map of the United States. I'm going to call the ggmap function and then inside of it I'm going to call get map on USA. When this map loads, it's not exactly what I expected. That's because it's zoomed in way too far. We are looking at the center of the United States. This is a region in Kansas that is near the center of the continental United States. But it zoomed in so far I don't have any context of the entire country. Let's try zooming this out to a country level. That's a zoom level of around four. So I'm going to add in my get map call, zoom equals four. And now when I retrieve a map, I have an area…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Visualizing data with maps2m 38s
-
(Locked)
Obtaining a Google Maps API key6m 58s
-
(Locked)
Working with maps3m 27s
-
(Locked)
Geocoding points4m 37s
-
(Locked)
Changing map types4m 18s
-
(Locked)
Plotting points on a map6m 42s
-
(Locked)
Building a map manually5m 37s
-
(Locked)
Creating a choropleth map9m 16s
-
-
-