if(!require(maptools)){
  install.packages("maptools"); library(maptools)
}
#1-------------------------------------------------
ifname<- "Caret_results_logAvPEClass.csv"
alldata <- read.delim(ifname, row.names=1,header=T, sep=",", as.is=TRUE, strip.white=FALSE)
head(alldata)
#2-------------------------------------------------
xdata<-tapply(alldata[,4],alldata[,3],function(vv){
  return(vv)
})
ydata<-tapply(alldata[,5],alldata[,3],function(vv){
  return(vv)
})
mname<-tapply(alldata[,1],alldata[,3],function(vv){
  return(vv)
})
nclass<-length(xdata)
#3-------------------------------------------------
pdf('PlotClass.pdf', width = 8, height = 8)
par(cex=0.8); xrange <- c(-4,1) ; yrange <- c(-1,4)
#4-------------------------------------------------
plot(xdata[[1]],ydata[[1]],xlim=xrange,ylim=yrange,
     xlab="AvPE",ylab="AvET",xaxt="n",yaxt="n",col="red",type="p")
pointLabel(xdata[[1]],ydata[[1]],labels=mname[[1]],col="black")
#dev.off()
points(xdata[[2]],ydata[[2]],col="blue",type="p")
pointLabel(xdata[[2]],ydata[[2]],labels=mname[[2]],col="black")
#5-------------------------------------------------
tickValues1 <- pretty(n=5,xrange)
tickStrings1 <- sprintf("%.3f",tickValues1) 
tickValues2 <- pretty(n=5,yrange)
tickStrings2 <- sprintf("%.3f",tickValues2) 
axis(side=1,at=tickValues1,labels=tickStrings1)
axis(side=2,at=tickValues2,labels=tickStrings2)
dev.off()