13.9 地图上的散点图
plot_mapbox()
使用 Mapbox 提供的地图服务,因此,需要注册一个账户,获取 MAPBOX_TOKEN
data("quakes")
::plot_mapbox(
plotlydata = quakes, colors = "Greys",
lon = ~long, lat = ~lat,
color = ~mag, size = 2,
type = "scattermapbox",
mode = "markers",
marker = list(opacity = 0.5)
|>
) ::layout(
plotlytitle = "Fiji Earthquake",
mapbox = list(
zoom = 3,
center = list(
lat = ~ median(lat - 5),
lon = ~ median(long)
)
)|>
) ::config(
plotlymapboxAccessToken = Sys.getenv("MAPBOX_TOKEN")
)