Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
docs: don't fail when files to clean don't exist
[simgrid.git] / docs / source / tuto_s4u / draw_gantt.R
1 #!/usr/bin/env Rscript
2 args = commandArgs(trailingOnly=TRUE)
3 library(ggplot2)
4
5 # Load and relabel the data
6 df = read.csv(args[1], header=F, strip.white=T)
7 names(df) = c("Type", "Actor", "Container", "Start", "End", "Duration", "Level", "State");
8
9 # Actually draw the graph
10 p = ggplot(df) + geom_segment(aes(x=Start, xend=End, y=Actor, yend=Actor,color=State), size=5);
11
12 # Cosmetics to compact the resulting graph
13 p.height <- length(unique(df$Actor)) * 0.05 + 2;
14 pdf(height = p.height)
15
16 # Produce the pdf file
17 plot(p)
18 dev.off()