plot_mapbox: Initiate a plotly-mapbox object

Description Usage Arguments Author(s) See Also Examples

View source: R/plotly.R

Description

Use this function instead of plot_ly() to initialize a plotly-mapbox object. This enforces the entire plot so use the scattermapbox trace type, and enables higher level geometries like add_polygons() to work

Usage

1

Arguments

data

A data frame (optional).

...

arguments passed along to plot_ly(). They should be valid scattermapbox attributes - https://plot.ly/r/reference/#scattermapbox. Note that x/y can also be used in place of lat/lon.

Author(s)

Carson Sievert

See Also

plot_ly(), plot_geo(), ggplotly()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 

plot_mapbox(res_mn)
plot_mapbox(res_mn, color = ~INDRESNAME)

map_data("world", "canada") %>%
  group_by(group) %>%
  plot_mapbox(x = ~long, y = ~lat) %>%
  add_polygons() %>%
  layout(
    mapbox = list(
      center = list(lat = ~median(lat), lon = ~median(long))
    )
  )

## End(Not run)

plotly documentation built on Nov. 8, 2019, 1:07 a.m.