# classChartsHodHawed.R # # Script to make the charts for the hod/hawed part of the vowel # space for all of the class, using the corrected formant values # that Ben and Tomas gave us. # # (c) by the class of Linguistics H286, Autumn 2007. # Start by setting the working directory to where you have put # the file correctedproductiondatatable.txt, which is a "massaged" # version of the file that Ben gave us, formatting it in a way to # let us read it into R easily. setwd('c:/Lx286/projectParts/termProjectPart2') # Read in the data file. x=read.table("correctedproductiondatatable.txt", header=T, sep="\t") # Could add a column for whether the speaker is a distinguisher or not, # like this. x$distinguish="yes" x$distinguish[x$speaker=="brandon" | x$speaker=="cj" | x$speaker=="caroline" | x$speaker=="joe" | x$speaker=="leo" | x$speaker=="mike" | x$speaker=="milo"]="no" # At least add a column of colors for the data points -- using black # for the distinguishers versus grey for the nondistinguishers. x$col="black" x$col[x$speaker=="brandon" | x$speaker=="cj" | x$speaker=="caroline" | x$speaker=="joe" | x$speaker=="leo" | x$speaker=="mike" | x$speaker=="milo"]="grey" # Figure out what ranges to use for F2 and F1. max(c(x$hod.f2,x$hawed.f2)) # [1] 1604 min(c(x$hod.f2,x$hawed.f2)) # [1] 992 max(c(x$hod.f1,x$hawed.f1)) # [1] 1030 min(c(x$hod.f1,x$hawed.f1)) # [1] 565 xlimF2=c(1610, 990) ylimF1=c(1035,560) # Set up a plotting pretty window for making a scatterplot. windows(width=4, height=4, pointsize=12) par(family="serif", oma=rep(0,4), mar=c(3,3,0.1,0.1), mgp=c(1.8,0.5,0), type="s") # Make a scatterplot showing the vowel space for the vowel in , # using an open square (22) for the plotting character. plot(x$hawed.f2, x$hawed.f1, xlim=xlimF2, ylim=ylimF1, pch=22, col=x$col, ylab="first formant (Hz)", xlab="second formant (Hz)") # Overlay points for the vowel in using a triangle (2). points(x$hod.f2, x$hod.f1, col=x$col, pch=2) legend("bottomright", c("hawed ","hod "), pch=c(22,2)) # Save the figure to a file. savePlot("classHodHawed", type="jpg")