我正在尝试使用R中的图进行地理空间分析,请参考以下链接
https://plot.ly/r/scatter-plots-on-maps/
我的数据集如下
Emirate Accidents Lat Lon
Abu Dhabi 2 24.4539 54.3773
Ajman 180 25.4052 55.5136
Dubai 50 25.2048 55.2708
Fujairah 3 25.4111 56.2482
Ras Al Kh 20 25.6741 55.9804
Sharjah 7777 25.3463 55.4209
Umm Al Qu 88 25.5205 55.7134
我使用的代码是
g <- list(
scope = 'asia',
showland = TRUE,
landcolor = toRGB("grey83"),
subunitcolor = toRGB("white"),
countrycolor = toRGB("white"),
showlakes = TRUE,
lakecolor = toRGB("white"),
showsubunits = TRUE,
showcountries = TRUE,
resolution = 50,
projection = list(
type = 'conic conformal',
rotation = list(lon = -100)
),
lonaxis = list(
showgrid = TRUE,
gridwidth = 0.5,
range = c(-140, -55),
dtick = 5
),
lataxis = list(
showgrid = TRUE,
gridwidth = 0.5,
range = c(20, 60),
dtick = 5
)
)
p <- plot_geo(df, lat = ~Lat, lon = ~Lon, color = ~Accidents) %>%
add_markers(
text = ~paste(df$Accidents, "inches"), hoverinfo = "text"
) %>%
layout(title = 'Distribution in UAE', geo = g)
但是我没有得到任何结果。任何帮助都会很棒。