From: Arnaud Giersch Date: Mon, 4 Mar 2013 22:33:03 +0000 (+0100) Subject: Add method draw2. X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba-papers.git/commitdiff_plain/5b5400d06cab932780185d192a82eb50f9ab6663?ds=sidebyside Add method draw2. I'll think about it... tomorrow. --- diff --git a/supercomp11/data/script.r b/supercomp11/data/script.r index 9694aba..3440b86 100644 --- a/supercomp11/data/script.r +++ b/supercomp11/data/script.r @@ -63,7 +63,7 @@ draw <- function(dset = ds, ## draw the time axis on the left axis(2, labels=TRUE) - mtext("Time (s)", side=2, line=2.5) + mtext("Simulated Time (s)", side=2, line=2.5) title(xlab="Algorithms") @@ -87,13 +87,58 @@ draw <- function(dset = ds, mtext("Data amount (relative)", side=4, line=2.5) ## finally, set title - t <- paste0(dset$Mode[1], dset$Distrib[1], " / ", dset$Ratio[1], " / ", + t <- paste0(dset$Mode[1], dset$Distrib[1], " / ", + dset$Ratio[1], " / ", dset$Platform[1], " / ", dset$Topo[1]) title(main=t) ## restore the graphical parameters par(p) + return(dset) +} + +draw2 <- function(dset) { + ## Extract useful data + x.1 <- 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 + x.2 <- reshape(x.1, direction="wide", idvar="Algo", timevar="Size") + + ## Rename rows + rownames(x.2) <- x.2$Algo + #colnames(x.2) <- sub("^[^.]*\\.", "", colnames(x.2)) + + ## Remove first column ("Algo") + x.3 <- as.matrix(x.2[-1]) + + x.4 <- x.3[, c(FALSE,FALSE,TRUE)] + barplot(x.4, beside=TRUE, + names.arg=sub("^[^.]*\\.", "", colnames(x.4)), + col=rainbow(nrow(x.3), s=.5)) + + x.4 <- x.3[, c(FALSE,TRUE,FALSE)] + barplot(x.4, beside=TRUE, + axes=FALSE, axisnames=FALSE, add=TRUE, + legend.text=TRUE, + col=rainbow(nrow(x.3))) + + x.4 <- x.3[, c(TRUE,FALSE,FALSE)] + barplot(x.4, beside=TRUE, + axes=FALSE, axisnames=FALSE, add=TRUE, + col=rainbow(nrow(x.3), 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) + } msg <- function(text, @@ -104,10 +149,21 @@ msg <- function(text, } msg("First test, with algorithms \"plain\"...", wait = FALSE); -draw(subset(ds, grepl("[lt]_plain", Algo))) +xx <- draw(subset(ds, grepl("[lt]_plain", Algo)), + draw_distrib="N") + +msg("... with draw2()...") +draw2(xx) msg("Second test, with algorithms \"bookkeeping\"..."); -draw(subset(ds, grepl("[lt]_bookkeeping", Algo))) +xx <- draw(subset(ds, grepl("[lt]_bookkeeping", Algo)), + draw_distrib="N") + +msg("... with draw2()...") +draw2(xx) msg("Third test, with all algorithms..."); -draw() +xx <- draw(draw_distrib="N") + +msg("... with draw2()...") +draw2(xx)