geom_text not working when ggmap and geom_point used

匆匆过客 提交于 2019-12-03 12:53:53

Your problem is that you haven't specified the aesthetics in geom_text correctly:

geom_text(data = df, aes(x = lon, y = lat, label = label), 
          size = 3, vjust = 0, hjust = -0.5)

You didn't tell geom_text to use the variables from the data frame df. If you don't do this, all aesthetics are inherited from the main call. Finally, when setting aesthetics to a single value, you don't do this inside of aes(), but outside.

I monkeyed with the hjust setting to get the labels to be visible.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!