Reputation: 1713
I have points on the map that are very close to each other and I would like to separate the labels because they are overlapping. I want to use spread.labels command, but I get an error smth along this line:
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
Upvotes: 0
Views: 854
Reputation: 1478
there are separate package for ggplot2, it's called ggrepel, can solve the problem
Upvotes: 1