参考this。
g <- list(showframe = FALSE,
coastlinecolor = toRGB("white"),
showland = TRUE,
landcolor = toRGB("gray80"),
showcountries = TRUE,
countrycolor = toRGB("white"),
countrywidth = 0.2,
projection = list(type = 'Mercator'))
plot_geo(New_A_loc,
marker = list(color = toRGB("purple"),
opacity = 0.5,
line = list(color = toRGB("purple"),
width = 0.5))) %>%
add_markers(
data = New_A_loc, x = ~Long, y = ~Lat,
hoverinfo = "text",text = ~City, alpha = 0.5
) %>%
layout(geo = g)
Full code with data。我面临的问题是,当我将鼠标移到数据点上时,我无法查看显示的文本框。我使用上述博主使用的相同方式,但我无法达到结果。