X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/06fb23775d9c37e19f357bea5c6dad37483553a0..5ed5698f8045a03bb3a8dac94146f1ccdcd440c1:/docs/source/tuto_s4u/draw_gantt.R diff --git a/docs/source/tuto_s4u/draw_gantt.R b/docs/source/tuto_s4u/draw_gantt.R new file mode 100644 index 0000000000..2d0c4e4df1 --- /dev/null +++ b/docs/source/tuto_s4u/draw_gantt.R @@ -0,0 +1,23 @@ +#!/usr/bin/env Rscript +args = commandArgs(trailingOnly=TRUE) +library(ggplot2) +df = read.csv(args[1], header=F, strip.white=T) +names(df) = c("Type", "Actor", "Container", "Start", "End", "Duration", "Level", "State"); +ggplot(df) + + geom_segment(aes(x=Start, xend=End, + y=Actor, yend=Actor,color=State), size=5) + + scale_fill_brewer(palette="Set1") + + theme_bw() + + theme ( + plot.margin = unit(c(0,0,0,0), "cm"), + legend.spacing = unit(1, "mm"), + panel.grid = element_blank(), + legend.position = "top", + legend.justification = "left", + legend.box.spacing = unit(0, "pt"), + legend.box.margin = margin(0,0,0,0)) -> p; + +p.height <- length(unique(df$Actor)) * 0.05 + 2; +pdf(height = p.height) +plot(p) +dev.off()