17  Mapping With plotly

17.1 Call Libraries

Show the code
library(plotly)

17.2 Set Geographic Parameters

Show the code
g <- list(showland = TRUE, 
          showcountries = TRUE,
          landcolor = toRGB("forestgreen"), # land color
          showocean = TRUE, # show ocean
          oceancolor = "lightblue", # ocean color
          # projection = list(type = 'robinson'),
          projection = list(type = 'orthographic',
                    rotation = list(lon = 0,
                                    lat = 0,
                                    roll = 0)))

17.3 Make a Map

Show the code
plot_geo() %>% 
  layout(title = "Demonstration Map", 
         geo = g)

17.4 scattermapbox

Show the code
plot_ly(type = "scattermapbox") %>%
  layout(
    mapbox = list(
      style = 'open-street-map',
      zoom = 6.0, # zoom
      center = list(lon = -83, lat = 42))) # centered on SE Michigan