I am using scatterpie in ggplot2 on a stamen map to create pie charts for admixture population genetics. I have successfully created a scatterpie plot layered onto a stamen map and now want to add labels to the pie plots. I would like to label them according to population.
Here is my piechart data
piedata:
pop region latitude longitude a1 a2 a3 a4
1 1 central 42.603 -120.085 0.464600 0.256383 0.201504 0.077513
2 3 central 42.136 -119.995 0.462215 0.268708 0.156554 0.112523
3 4 central 41.538 -119.982 0.581500 0.388340 0.012820 0.017340
4 5 south 41.179 -119.964 0.437200 0.327943 0.130400 0.104457
5 7 east 42.148 -119.250 0.298107 0.503387 0.125040 0.073467
6 8 east 41.759 -119.915 0.385957 0.437729 0.094271 0.082043
7 9 east 41.048 -119.435 0.492756 0.389556 0.086244 0.031444
8 10 south 41.092 -120.421 0.305267 0.036933 0.220667 0.437133
9 11 NW 42.756 -120.426 0.002000 0.996000 0.002000 0.000000
10 13 west 42.170 -120.648 0.999600 0.000000 0.000400 0.000000
11 14 west 41.868 -121.629 0.516343 0.483029 0.000229 0.000400
12 15 west 41.707 -121.183 0.826425 0.160600 0.010125 0.002850
13 16 west 41.442 -120.536 0.690019 0.277257 0.018114 0.014610
14 17 west 41.318 -121.106 0.846600 0.150067 0.002667 0.000667
15 18 south 40.611 -120.085 0.438320 0.423008 0.080568 0.058104
16 19 south 40.581 -120.610 0.803067 0.196933 0.000000 0.000000
Here is the successful code to create a stamen map with scattered pies charts for genetic data per population in each region.
ggmap(usmap) +
geom_polygon(aes(x=long, y=lat, group=group),
data=studyarea,
color="dark red", alpha=.2, linewidth=.4) +
geom_scatterpie(aes(x = longitude, y = latitude),
data = data, pie_scale=2,
cols = c("a1","a2","a3","a4"), color=NA) + coord_equal()
Which generates the image below:
I tried using various forms of geom_label and geom_text with no success. Thank you in advance