我在地图上有彼此非常接近的点,我想将标签分开,因为它们是重叠的。我想使用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 发布于 2017-07-28 12:46:15
有一个单独的ggplot2包,叫做ggrepel,可以解决这个问题
https://stackoverflow.com/questions/24127888
复制相似问题