Session Ready
Exercise

Geo layout

In the previous exercise you saw the default settings for the geo layout in plotly, but this it is quite easy to customize by specifying additional arguments in the list passed to geo in layout().

In this exercise you will explore a few useful options outlined below:

  • To change the color of the landmass, add the arguments showland = TRUE and set a landcolor.
  • To make lakes distinct from landmasses, add the arguments showlakes = TRUE and set a lakecolor.
  • To display states/provinces, set showsubunit = TRUE, and the set subunitcolor.
  • To display countries, set showcountries = TRUE, and the set countrycolor.

Note that you must use the toRGB() function in order to pass R colors to the geo layout.

plotly has already been loaded for you.

Instructions
100 XP
  • Customize the appearance of your map from the previous exercise by defining the list g and passing it to the geo layout:
    • Set the landmass color with "gray90".
    • Set the lake color with "white".
    • Set the state (subunit) color with "white".