Plotly&地理数据 - hovertext未显示

时间:2018-02-13 13:53:28

标签: r geospatial plotly

我正试图使用​​R的地理空间功能和情节。

除了悬停文本外,地图会做它应该做的事情。它没有显示,我真的不明白为什么。

这里有数据:

Datum       City        LAT LONG    ZIEL_LAT    ZIEL_LONG
11.07.2016  München     48  11      51          8
16.07.2016  Lippstadt   51  8       41          -87
28.07.2016  Chicago     41  -87     35          -80
31.07.2016  Charlotte   35  -80     35          50
...

输出: Code output

如您所见:没有悬停文字。我的鼠标位于其中一个城市(屏幕截图中未显示)。

这里是R代码:

bayernRoute <- read.csv(file="C:/Users/imon.bashir/Dropbox/6. Semester/Data Science/Hausarbeit/BayernRoute.csv", header=TRUE, sep=";")

# map projection
geo <- list(
  scope = 'world',
  projection = list(type = 'azimuthal equal area'),
  showland = TRUE,
  landcolor = toRGB("honeydew2")
)

p <- plot_geo(color = I("red")) %>%
  add_markers(
  data = bayernRoute, x = ~LONG, y = ~LAT, text = ~City,
 size=0.5, hoverinfo = "text", alpha = 0.5
) %>%
  add_segments(
    data = bayernRoute,
    x = ~LONG, xend = ~ZIEL_LONG,
    y = ~LAT, yend = ~ZIEL_LAT,
    alpha = 0.3, size = I(1), hoverinfo = "none"
  ) %>%
  layout(
    title = 'FC Bayern Munich Flight Route',
    geo = geo, showlegend = FALSE
  )
p

0 个答案:

没有答案