Duy Dinh - 2013-10-22

This R script is used to print results obtained by combining frequency of change pattern vs. MAA (non) correlations.

author: Duy Dinh, CRP Henri Tudor

date: 22 Oct. 2013

-------------------------------------- SETTINGS

(please change the values of the following variables accordingly)

statFileName="/home/duy/Desktop/JBS/results/combined-frequency-similarity-results.txt"

statFileName="/home/duy/Desktop/JBS/results/combined-frequency-similarity-results-DD.txt"

outputImage=TRUE
outputImage=FALSE

------------------------------------- END SETTINGS

data = read.table(statFileName, header=FALSE)

transpose of data

data = t(data)

par(mfrow=c(1, 2)) # display 2 figures / row on one row

par(mfrow=c(2, 2)) # display 2 figures / row on two rows

x = c(.1, .2, .3, .4, .5, .6, .7, .8, .9, 1.0)

line colors

lColors=c('red', 'green', 'blue', 'black')

line styles

lStyles=c(1, 2, 3, 4)

line plot characters

lPlotChars=c(21, 22, 23, 24)

cexValueLegend=.9

start graphics drawing

if (outputImage == TRUE){
outputImageFileName = "output.eps"
postscript(file=outputImageFileName, horizontal=FALSE, width=10, height=6)
outputImageFileName = "output.png"
png(filename=outputImageFileName, width = 800, height = 600)
}

--------------------- Step 1: plot the TRUE IMPACT results

maxY = max(data[2, 3:12], data[6, 3:12])

plot(x, data[2, 3:12], type="b", xlab="Similarity", ylab="Frequency", main=data[2, 2:2], pch=lPlotChars[1], lty=lStyles[1], col=lColors[1], ylim=c(0, maxY))
lines(x, data[6, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[2], lty=lStyles[2], col=lColors[2])

add legend

legend(0.1, maxY, c(toString(data[2:2, 1]), toString(data[6:6, 1])), cex=cexValueLegend,
col=lColors,
pch=lPlotChars,
lty=lStyles,
horiz=FALSE, bty="n")

--------------------- Step 2: plot the FALSE IMPACT 3 results

maxY=max(data[5, 3:12], data[9, 3:12], data[11, 3:12], data[12, 3:12])

plot(x, data[5, 3:12], type="b", xlab="Similarity", ylab="Frequency", main=data[10, 2:2], pch=lPlotChars[1], lty=lStyles[1], col=lColors[1], ylim=c(0, maxY))
lines(x, data[9, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[2], lty=lStyles[2], col=lColors[2])
lines(x, data[11, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[2], lty=lStyles[2], col=lColors[2])
lines(x, data[12, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[3], lty=lStyles[3], col=lColors[3])

add legend

legend(0.1, maxY, c(toString(data[5:5, 1]), toString(data[9:9, 1]), toString(data[9:9, 1]), toString(data[12:12, 1])), cex=cexValueLegend,
col=lColors,
pch=lPlotChars,
lty=lStyles,
horiz=FALSE, bty="n")

--------------------- Step 3: plot MOVE results

plot(x, data[2, 3:12], type="b", xlab="Similarity", ylab="Frequency", main=data[2, 1:1], pch=lPlotChars[1], lty=lStyles[1], col=lColors[1])
lines(x, data[3, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[2], lty=lStyles[2], col=lColors[2])
lines(x, data[4, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[3], lty=lStyles[3], col=lColors[3])
lines(x, data[5, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[4], lty=lStyles[4], col=lColors[4])

add legend

legend(0.1, 30, data[2:5, 2], cex=cexValueLegend,
col=lColors,
pch=lPlotChars,
lty=lStyles,
horiz=FALSE, bty="n")

--------------------- Step 4: plot DERIVE results

plot(x, data[6, 3:12], type="b", xlab="Similarity", ylab="Frequency", main=data[6, 1:1], pch=lPlotChars[1], lty=lStyles[1], col=lColors[1])
lines(x, data[7, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[2], lty=lStyles[2], col=lColors[2])
lines(x, data[8, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[3], lty=lStyles[3], col=lColors[3])
lines(x, data[9, 3:12], type="b", xlab="Similarity", ylab="Frequency", pch=lPlotChars[4], lty=lStyles[4], col=lColors[4])

add legend

legend(0.1, 75, data[6:9, 2], cex=cexValueLegend,
col=lColors,
pch=lPlotChars,
lty=lStyles,
horiz=FALSE, bty="n")

if (outputImage){
dev.off()
}

 

Last edit: Duy Dinh 2013-10-22