Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill trailing spaces
[simgrid.git] / docs / source / tuto_s4u / draw_gantt.R
1 #!/usr/bin/env Rscript
2 args = commandArgs(trailingOnly=TRUE)
3 library(ggplot2)
4 df = read.csv(args[1], header=F, strip.white=T)
5 names(df) = c("Type", "Actor", "Container", "Start", "End", "Duration", "Level", "State");
6 ggplot(df)
7     geom_segment(aes(x=Start, xend=End,
8                      y=Actor, yend=Actor,color=State), size=5)
9     scale_fill_brewer(palette="Set1")
10     theme_bw()
11     theme (
12         plot.margin = unit(c(0,0,0,0), "cm"),
13         legend.spacing = unit(1, "mm"),
14         panel.grid = element_blank(),
15         legend.position = "top",
16         legend.justification = "left",
17         legend.box.spacing = unit(0, "pt"),
18         legend.box.margin = margin(0,0,0,0)) -> p;
19
20 p.height <- length(unique(df$Actor)) * 0.05 + 2;
21 pdf(height = p.height)
22 plot(p)
23 dev.off()