Dynamic position for ggplot2 objects (especially geom_text)?

后端 未结 4 1611
半阙折子戏
半阙折子戏 2020-12-13 20:52

When using ArcGIS to make maps, the software by default pushes point and polygon labels around automatically to avoid overlap using a proprietary algorithm. They refer to t

4条回答
  •  一向
    一向 (楼主)
    2020-12-13 21:26

    I ran into a similar problem with several of the plots I have been working with and wrote a basic package that uses force field simulation to adjust object location. While much improvement is possible, including integration with ggplot, etc. it seems to get the task accomplished. The following illustrates the functionality:

    install.packages("FField", type = "source")
    install.packages("ggplot2")
    install.packages("gridExtra")
    library(FField)
    FFieldPtRepDemo()
    

提交回复
热议问题