+ return(dset)
+}
+
+draw2 <- function(dset = ds,
+ draw_mode = "R",
+ draw_distrib = 1,
+ draw_ratio = "1:1",
+ draw_platform = "cluster",
+ draw_topo = "hcube") {
+
+ ## extract desired data
+ dset <- subset(dset,
+ Mode == draw_mode & Distrib == draw_distrib &
+ Ratio == draw_ratio &
+ Platform == draw_platform & Topo == draw_topo)
+
+ ## reorder lines (first "plain", then "bookkeeping")
+ dset <- rbind(subset(dset, grepl("plain", Algo)),
+ subset(dset, grepl("bookkeeping", Algo)))
+ dset <- dset[order(dset$Size), ]
+
+ ## keep only useful data
+ dset.long <- data.frame(Algo=dset$Algo, Size=dset$Size,
+ Idle_avg=dset$Idle_avg,
+ Conv_avg=dset$Conv_avg,
+ Conv_max=dset$Conv_max)
+
+ ## reshape data -> wide
+ dset.wide <- reshape(dset.long, direction="wide",
+ idvar="Algo", timevar="Size")
+
+ ## rename rows
+ rownames(dset.wide) <- sub("bookkeeping", "virtual", dset.wide$Algo)
+ #colnames(dset.wide) <- sub("^[^.]*\\.", "", colnames(dset.wide))
+
+ ## remove first column (aka "Algo")
+ dset.mat <- as.matrix(dset.wide[-1])
+
+ dset.plot <- dset.mat[, c(FALSE,FALSE,TRUE)]
+ barplot(dset.plot, beside=TRUE,
+ names.arg=sub("^[^.]*\\.", "", colnames(dset.plot)),
+ col=rainbow(nrow(dset.mat), s=.5))
+
+ dset.plot <- dset.mat[, c(FALSE,TRUE,FALSE)]
+ barplot(dset.plot, beside=TRUE,
+ axes=FALSE, axisnames=FALSE, add=TRUE,
+ legend.text=TRUE,
+ args.legend=list(x="topleft", inset=c(.02,0), title="Algorithms"),
+ col=rainbow(nrow(dset.mat)))
+
+ dset.plot <- dset.mat[, c(TRUE,FALSE,FALSE)]
+ barplot(dset.plot, beside=TRUE,
+ axes=FALSE, axisnames=FALSE, add=TRUE,
+ col=rainbow(nrow(dset.mat), v=.5))
+
+ ## finally, set titles
+ t <- paste0(dset$Mode[1], dset$Distrib[1], " / ",
+ dset$Ratio[1], " / ",
+ dset$Platform[1], " / ", dset$Topo[1])
+ title(xlab="Platform size",
+ ylab="Simulated time (s)",
+ main=t)
+