课程: Data Visualization in R with ggplot2

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Plotting points on a map

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 those two tasks and begin plotting data points on a map. I already have the code loaded here to geocode a couple of points. Let's run that and complete that geocoding, and now let's use one of those points to pull up a map of the United States. I'm going to use the ggmap function on get_map using this USA point that I geocoded. Well, that doesn't look like what I expected. That's because this is zoomed in way too far. We're looking at a region in Kansas that is near the center of the continental United States. Let's try zooming this out a little bit. There we go. Now that's the map of the United States that we're more familiar with. Now let's try plotting a point on this map. How about if we try to put a point on this for New York City? Remember, ggmap works just like ggplot, so we can just add a point geometry onto our map with the + operator. I'm going to add a + and then a…

内容