# Usage: launch R, and then: source("script.r") # load dataset (variable is "ds") load("data.rda") # extract data for plain algorithms, in real mode ds.base <- subset(ds, Mode == "R" & grepl("[lt]_plain", Algo)) # extract data for one experiment #xx <- subset(ds, # Mode == "R" & Distrib == 1 & Ratio == "1:1" & # Platform == "cluster" & Size == 16 & Topo == "line") xx <- subset(ds, Mode == "R" & Distrib == "N" & Ratio == "1:1" & Platform == "cluster" & Topo == "hcube") # only keep plain algorithms with default value for k... xx <- subset(xx, grepl("[lt]_plain", Algo)) # reorder lines (first "plain", then "bookkeeping") xx <- rbind(subset(xx, grepl("plain", Algo)), subset(xx, grepl("bookkeeping", Algo))) xx <- xx[order(xx$Size), ] # finally, add an "Index" attribute(, for further processing xx <- cbind(xx, Index=c(1:length(xx$Size))) # save the graphical parameters p <- par(no.readonly=TRUE) ### TODO ### - add some spacing between each size ### - fill in empty rows (e.g. with large size) ### - add a label telling the size par(mar=c(13, 4, 4, 4) + 0.1, # change margins mgp=c(11, 1, 0)) par(las=3) # always draw labels vertically # compute the time range: 0..max+20% time_range <- c(0, range(xx$Conv_max)[2] * 1.2) # first draw the bars barplot(xx$Conv_max, axes=FALSE, col="red", names=xx$Algo, ylim=time_range) barplot(xx$Conv_avg, axes=FALSE, col="green", add=TRUE) barplot(xx$Idle_avg, axes=FALSE, col="blue", add=TRUE) # draw the time axis on the left axis(2, labels=TRUE) mtext("Time (s)", side=2, line=2.5) title(xlab="Algorithms") # start a new graph, but drawn on the same device # compute the data range x_data_range <- c(0.6, length(xx$Algo) + 0.4) data_range <- c(0, range(xx$Data_amnt)[2] * 1.04) # draw the data amnt line graph #par(new=TRUE) #plot(xx$Data_amnt, axes=FALSE, xlab="", type="b", # xlim=x_data_range, # yaxs="i", ylim=data_range) for (alg in unique(xx$Algo)) { print(alg); yy <- subset(xx, Algo == alg) par(new=TRUE) plot(yy$Index, yy$Data_amnt, axes=FALSE, xlab="", type="b", xlim=x_data_range, yaxs="i", ylim=data_range) } # draw the data amnt axis on the right axis(4, labels=TRUE) mtext("Data amount (relative)", side=4, line=2.5) # finally, set title t <- paste0(xx$Mode[1], xx$Distrib[1], " / ", xx$Ratio[1], " / ", xx$Platform[1], " / ", xx$Topo[1]) title(main=t) # restore the graphical parameters par(p)