# Admixture maps in R for Dummies

Before we get started, I’d like to point everyone to an excellent tutorial here by Kim Gilbert on making maps in R. I have been grappling with overlaying admixture plots, and migration routes on top of maps recently, and thought I’d put together a quick tutorial on that. What you will need:

1. GPS coordinates
Eg. gps.data
```ID,Lat,Lon
1,33.72,-94.40
2,34.1682185,-111.930907
3,37.2718745,-119.2704153
```

2. Admixture proportions – these are routinely printed out as the “Q” matrix by STRUCTURE, and in a file suffixed with a “Q” by ADMIXTURE. I added a column with sample sizes to this, to proportionately resize the admixture pies.
```K1,K2,Num
0.836601,0.163399,12
0.565904,0.434096,16
0.508735,0.491265,18
0.111114,0.888886,9
```

3. maps() and plotrix() packages in R

```#Initialize packages
library(maps)
library(plotrix)
map(”state”) #Plot maps
points(gps\$Lon, gps\$Lat,
for (x in 2:nrow(gps)) { #To add arrows for migration models
arrows(gps\$Lon[1],gps\$Lat[1],gps\$Lon[x],
gps\$Lat[x],lty=”dashed”,code=2)
} #To add admixture plots – here I used K = 2.
for (x in 1:nrow(gps)) { floating.pie(gps\$Lon[x],gps\$Lat[x], #You can modify your loop to reflect this