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

Plotting points on a map

From the course: Data Visualization in R with ggplot2

Start my 1-month free trial

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…

Contents