Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / docs / source / tuto_s4u / draw_gantt.R
1 #!/usr/bin/env Rscript
2 args = commandArgs(trailingOnly=TRUE)
3 library(tidyverse)
4 library(pajengr)
5
6 # Load and relabel the data
7 df = pajeng_read(args[1])
8 df$state %>%
9     # rename some columns to use SimGrid terminology
10     rename(Actor = Container,
11            State = Value) %>%
12     # do the plot
13     ggplot() +
14     geom_segment(aes(x=Start, xend=End, y=Actor, yend=Actor, color=State), size=5) -> p
15
16 # Cosmetics to compact the resulting graph
17 p.height <- length(unique(df$state$Actor)) * 0.05 + 2
18 pdf(height = p.height)
19
20 # Produce the pdf file
21 plot(p)
22 dev.off()