Session Ready
Exercise

Different maps

The default Google map downloaded by get_map() is useful when you need major roads, basic terrain, and places of interest, but visually it can be a little busy. You want your map to add to your data, not distract from it, so it can be useful to have other "quieter" options.

Sometimes you aren't really interested in the roads and places, but more what's on the ground (e.g. grass, trees, desert, or snow), in which case switching to a satellite view might be more useful. You can get Google satellite images by changing the maptype argument to "satellite".

You can grab Stamen Maps by using source = "stamen" in get_map(), along with specifying a maptype argument. You can see all possible values for the maptype argument by looking at ?get_map, but they correspond closely to the "flavors" described on the Stamen Maps site. I like the "toner" variations, as they are greyscale and a bit simpler than the Google map.

Let's try some other maps for your plot of house sales.

Instructions 1/2
undefined XP
  • 1
    • Edit your original call to get_map() to get a "satellite" image from Google by adding a maptype argument.
    • Display a plot of house sales coloured by year_built using the satellite map.
    • 2
      • Edit your original call to get_map() to get a toner map from Stamen by adding a source argument and a maptype argument.
      • Display a plot of house sales coloured by year_built using the toner map.