0

我在地图上的点彼此非常接近,我想将标签分开,因为它们是重叠的。我想使用 spread.labels 命令,但是我在这条线上得到了一个错误:

Error in text.default(newx, y + offsets, labels[sort.index], srt = srt,  : plot.new has not been called yet  

  mp = get_map(location = "Canada", maptype="satellite", color="color")
p = ggmap(mp) +
  geom_point(data=df1, aes(x=decLon, y = decLat), color="red", size=2.6) +
  spread.labels(x=df1$decLon, y=df1$decLat, label=df1$Site, offsets=0.5)
p   
4

1 回答 1

1

ggplot2有单独的包,叫做ggrepel,可以解决问题

于 2017-07-28T04:46:15.330 回答