#################################################################### # KoreanStops.R # # Script for plotting the H1-H2 values against the VOT values # in the KoreanStops exercise from the book "A Laboratory Course in # Phonology" -- copyright Mary E. Beckman & Janet B. Pierrehumbert # Set the working directory and read in the data file. setwd('C:/Lx600.01/KoreanStops') Kor=read.table("H_results.txt",header=TRUE,sep="\t") # See what the column names are and then make the derived data # columns. names(Kor) # [1] "file" "C" "pos" "closure" "burst" "VOT" "h1dB" # [8] "h2dB" Kor$cDur=(Kor$burst-Kor$closure)*1000 Kor$votDur=(Kor$VOT-Kor$burst)*1000 Kor$dH1H2=Kor$h1dB-Kor$h2dB # Make a plotting window. windows(height=6,width=6,pointsize=12) par(family="serif",oma=rep(0,4),mar=c(4,4,1,0)+0.2) # Select the subset of stops that are in Intonational Phrase initial # position and then plot them. plotmat=subset(Kor, pos=="IP") # Specify a plotting character that is a filled circle (and keep # this for the lax stops). plotmat$pch=19 # Change to a plotting character that is a filled triangle for # the tense stops. plotmat$pch[plotmat$C=="pp"]=17 # Change to a plotting character that is an open square for # the aspirated stops. plotmat$pch[plotmat$C=="ph"]=22 plot(plotmat$votDur,plotmat$dH1H2,pch=plotmat$pch, xlim=c(0,110),ylim=c(-8,31), xlab="VOT (ms)",ylab="H1 minus H2 (dB)") legend("topleft", c("lax","tense","aspirated"), pch=c(19,17,22)) mtext("intonational phrase initial position",line=0.2) savePlot("KoreanStopsIPinitial",type="jpg") # Now do the same for the subset of stops that are in AP # medial position. plotmat=subset(Kor, pos=="AM") # Specify a plotting character that is a filled circle (and keep # this for the lax stops). plotmat$pch=19 # Change to a plotting character that is a filled triangle for # the tense stops. plotmat$pch[plotmat$C=="pp"]=17 # Change to a plotting character that is an open square for # the aspirated stops. plotmat$pch[plotmat$C=="ph"]=22 # Add file numbers so that can see which tokens have short VOT # in order to pick them out and examine them. plotmat$no=gsub("HP[A-Z]*","",as.character(plotmat$file)) plotmat2=subset(plotmat, C=="b") plot(plotmat$votDur,plotmat$dH1H2,pch=plotmat$pch, xlim=c(0,110),ylim=c(-8,31), xlab="VOT (ms)",ylab="H1 minus H2 (dB)") text(plotmat2$votDur,plotmat2$dH1H2,plotmat2$no,cex=0.75,adj=c(1,1)) legend("bottomright", c("lax","tense","aspirated"), pch=c(19,17,22)) mtext("accentual phrase medial position",line=0.2) savePlot("KoreanStopsAPmedial",type="jpg") # Add a factor saying which of the lax stops have voicing # throughout the closure. plotmat2$voiced=factor(rep("v",10),levels=c("v","u")) plotmat2$voiced[c(2,3,6,7,8,10)]="u" plotmat3=subset(plotmat2, voiced=="v") # Now plot the closure duration against the VOT. plot(plotmat$votDur,plotmat$cDur,pch=plotmat$pch, xlim=c(0,110),ylim=c(20,130), xlab="VOT (ms)",ylab="closure duration (ms)") text(plotmat2$votDur,plotmat2$cDur,plotmat2$no,cex=0.75,adj=c(1,1)) points(plotmat3$votDur,plotmat3$cDur,pch=1,col="red",cex=1.5) legend("topright", c("lax","(voiced)","tense","aspirated"), pch=c(19,1,17,22),col=c("black","red","black","black")) mtext("accentual phrase medial position",line=0.2) savePlot("KoreanStopsAPmedialClosure",type="jpg")