课程: Data Visualization in R with ggplot2

免费学习该课程!

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

Mapping colleges

Mapping colleges

- [Instructor] All right, let's get started. To begin, I have some code already prepared that brings us to the point where we were earlier in the course. If I run all of this code, you can see that it gives us a basic map of the continental United States drawn as a series of 48 polygons. The only difference is that I've colored the state border's gray and the fill for each state polygon is beige. Now, the next thing I'd like to do is plot the points for our colleges and universities on the map. I can do this by adding a point geometry to the plot that uses the college tibble as its dataset. So let's go ahead and add geom underscore point, data coming from the college dataset, and my mapping will be X is longitude, Y is latitude. Now, this seems close to what I want, but there are a few points floating out there in space. Those look like they correspond to schools in Alaska and Hawaii. I only want to include the continental US on the map, so let me filter those out. I'm going to take…

内容