adjusting the bttleship plot
This commit is contained in:
parent
e778d86ea8
commit
0e87a3b71d
1 changed files with 73 additions and 1 deletions
|
|
@ -7,7 +7,79 @@ title: "Chapter 6"
|
||||||
CV transmission etc..
|
CV transmission etc..
|
||||||
|
|
||||||
Figure 6.4
|
Figure 6.4
|
||||||
|
kroeber seriation:
|
||||||
|
|
||||||
|
```{r battleship-seriation, fig.width=7.2, fig.height=4.8, fig.cap=""}
|
||||||
|
dt <- data.frame(
|
||||||
|
"Black-on-Red" = c(1,2, 2, 2, 3, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0),
|
||||||
|
"Three-Color" = c(0,0, 0, 0, 0, 0, 1, 1, 3, 4, 3, 2, 0, 0, 0, 0),
|
||||||
|
"Corrugated" = c(1,1, 0, 1, 2, 3, 2, 7, 4, 7, 9, 10, 11, 10, 15, 20),
|
||||||
|
check.names = FALSE
|
||||||
|
)
|
||||||
|
rownames(dt) <-
|
||||||
|
c( "Zuni",
|
||||||
|
"Towway",
|
||||||
|
"Kolliwa",
|
||||||
|
"Shunnte",
|
||||||
|
"Wimmay",
|
||||||
|
"Mattsak",
|
||||||
|
"Kyakki",
|
||||||
|
"Pinnawa",
|
||||||
|
"Site W",
|
||||||
|
"Hattsina",
|
||||||
|
"Kyakki W",
|
||||||
|
"Shoptlu",
|
||||||
|
"Hawwik B",
|
||||||
|
"Te\\'alla",
|
||||||
|
"Site X",
|
||||||
|
"Tetlnat"
|
||||||
|
)
|
||||||
|
ship_cols <- c("#8c6bb1", "#1f77b4", "#ff7f0e")
|
||||||
|
series_col <- ncol(dt)
|
||||||
|
n_phase <- nrow(dt)
|
||||||
|
|
||||||
|
dt_pct <- sweep(as.matrix(dt), 2, colSums(as.matrix(dt)), "/") * 100
|
||||||
|
|
||||||
|
par(mfrow = c(1, 3), las = 1, bty = "n", mar = c(0,0, 3,0), oma = c(0, 6, 0, 0),xpd=NA)
|
||||||
|
phase_axis <- seq_len(n_phase)
|
||||||
|
phase_labels <- rownames(dt)
|
||||||
|
|
||||||
|
for (s in seq_len(series_col)) {
|
||||||
|
plot(
|
||||||
|
NA,
|
||||||
|
xlim = c(-(max(dt_pct[,s]/2)),max(dt_pct[,s]/2)),
|
||||||
|
ylim = c(0.5, n_phase + 0.5),
|
||||||
|
axes = FALSE,
|
||||||
|
xlab = "Width = relative frequency (%)",
|
||||||
|
ylab = ifelse(s == 1, "Phase", ""),
|
||||||
|
main = colnames(dt)[s]
|
||||||
|
)
|
||||||
|
|
||||||
|
for (r in phase_axis) {
|
||||||
|
chip_bottom <- (n_phase - r) + 0.55
|
||||||
|
chip_top <- (n_phase - r) + 1.45
|
||||||
|
chip_width <- dt_pct[r, s]
|
||||||
|
|
||||||
|
rect(
|
||||||
|
-chip_width / 2,
|
||||||
|
chip_bottom,
|
||||||
|
chip_width / 2,
|
||||||
|
chip_top,
|
||||||
|
col = ship_cols[s],
|
||||||
|
border = "white"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(s==1)
|
||||||
|
text(-(max(dt_pct[,s]/2)),seq((0.55+1.45)/2, (0.55+1.45)/2*n_phase ,length.out=n_phase),phase_labels,pos=2,font=2,,cex=2)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
A more common wa to represent tht would be to plot the freuecny through time, using
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
plot(1,1)
|
matplot(cbind(1:nrow(dt) ,1:nrow(dt) ,1:nrow(dt)) ,dt,type="l",lwd=3,col=ship_cols,lty=1)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This should remind you of the plot about chnges in allele frquency seen in Chapter 3, we will see later how we cna use these describption of the dt to test hypothese about the cultural transmission process
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue