library(sm) library(Hmisc)
path="/home/duy/Desktop/ISWC-2013/results/stability"
outputpath="/home/duy/Desktop/ISWC-2013/images" outputImage=TRUE
outputImg = paste(outputpath, "stability", sep="/") outputImg = paste(outputImg, "eps", sep=".")
if (outputImage == TRUE){ postscript(file=outputImg, horizontal=FALSE, height=4, width=15) #png(filename=outputImg) }
lineColors <- c("black", "blue", "violet") plotChars <- c(1, 22, 17)
files <- list.files(path, full.names=TRUE) names <- list.files(path) n <- length(files) cexValue=.8 cexValueLegend=.84
par(mfrow=c(n/2,n/2), mar=c(2,2,2,2)) tickLabs=c(2, 4, 6, 8, 10, 15, 20) xTickCount=0.1 yTickCount=1
minX=0.0 maxX=1.0
minY=0 maxY=25
for (i in 1: n){ data=read.table(files[i], header=TRUE) plot(data$INTERVAL, data$Character_based_ED, type="o", xlab="", ylab="", #xlab="Similarity", ylab="#Correlation", pch=plotChars[1], col=lineColors[1], ylim=c(0, maxY), cex=cexValue, lty=lineStyles[1], main=names[i], xaxt = "n") # draw an axis on the bottom axis(1, at=data$INTERVAL,labels=data$INTERVAL, col.axis="black", las=1)
lines(data$INTERVAL, data$Word_based_ED, type="o", pch=plotChars[2], col=lineColors[2], cex=cexValue, lty=lineStyles[2]) lines(data$INTERVAL, data$Knowledge_based_Similarity, type="o", pch=plotChars[3], col=lineColors[3], cex=cexValue, lty=lineStyles[3])
# add legend legend(0.52, 25, gsub("_", " ", names(data[2:length(data)])), cex=cexValueLegend, col=lineColors, pch=plotChars, lty=lineStyles, horiz=FALSE, bty="n"); }
if (outputImage){ dev.off() }
Log in to post a comment.
!/bin/bash
-----------------------------------
R script to display the aggregated similarity values in intervals from 0 to 1
@author: Duy Dinh, CRP Henri Tudor
@date: 22 April 2013
-----------------------------------
library(sm)
library(Hmisc)
directory containing results files
each file has 6 columns: NoCT SUP SUB SIB ALL
path="/home/duy/Desktop/ISWC-2013/results/stability"
Output directory
outputpath="/home/duy/Desktop/ISWC-2013/images"
outputImage=TRUE
outputImage=FALSE
output image file name
outputImg = paste(outputpath, "stability", sep="/")
outputImg = paste(outputImg, "eps", sep=".")
start graphics drawing
if (outputImage == TRUE){
postscript(file=outputImg, horizontal=FALSE, height=4, width=15)
#png(filename=outputImg)
}
lineColors <- c("black", "blue", "violet")
plotChars <- c(1, 22, 17)
number of files
files <- list.files(path, full.names=TRUE)
names <- list.files(path)
n <- length(files)
cexValue=.8
cexValueLegend=.84
distribute plots on the grid
par(mfrow=c(n/2,n/2), mar=c(2,2,2,2))
tickLabs=c(2, 4, 6, 8, 10, 15, 20)
xTickCount=0.1
yTickCount=1
intervals
minX=0.0
maxX=1.0
numbers of correlations found
minY=0
maxY=25
the input of the following function MUST be a numeric list
read data from files
for (i in 1: n){
data=read.table(files[i], header=TRUE)
plot(data$INTERVAL, data$Character_based_ED, type="o", xlab="", ylab="", #xlab="Similarity", ylab="#Correlation",
pch=plotChars[1], col=lineColors[1],
ylim=c(0, maxY), cex=cexValue, lty=lineStyles[1], main=names[i], xaxt = "n")
# draw an axis on the bottom
axis(1, at=data$INTERVAL,labels=data$INTERVAL, col.axis="black", las=1)
lines(data$INTERVAL, data$Word_based_ED, type="o", pch=plotChars[2], col=lineColors[2], cex=cexValue, lty=lineStyles[2])
lines(data$INTERVAL, data$Knowledge_based_Similarity, type="o", pch=plotChars[3], col=lineColors[3], cex=cexValue, lty=lineStyles[3])
# add legend
legend(0.52, 25, gsub("_", " ", names(data[2:length(data)])), cex=cexValueLegend, col=lineColors, pch=plotChars, lty=lineStyles, horiz=FALSE, bty="n");
}
turn off graphical device
if (outputImage){
dev.off()
}