Get startedGet started for free

Insight through aesthetics

Adding a map to your plot of sales explains some of the structure in the data: there are no house sales East of the Willamette River or on the Oregon State University campus. This structure is really just a consequence of where houses are in Corvallis; you can't have a house sale where there are no houses!

The value of displaying data spatially really comes when you add other variables to the display through the properties of your geometric objects, like color or size. You already know how to do this with ggplot2 plots: add additional mappings to the aesthetics of the geom.

Let's see what else you can learn about these houses in Corvallis.

NOTE: Many exercises in this course will require you to create more than one plot. You can toggle between plots with the arrows at the bottom of the 'Plots' window and zoom in on a plot by clicking the arrows on the tab at the top of the 'Plots' window.

This exercise is part of the course

Visualizing Geospatial Data in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Map color to year_built
ggmap(corvallis_map) +
  geom_point(aes(lon, lat), data = sales)
Edit and Run Code