Reputation: 14309
I would like to use ggplot2 for this but have no idea where to look. I have a global start and end time min(begin)
and max(end)
respectively which is my x axis. My y axis would be each processor and my data includes for each processor the time chunks where the compiler would be busy compiling or linking a specific file. I would like to see the empty areas where a Processor is idle. My df would look like this:
df <- data.frame(proc = as.factor(c('P_1', 'P_1', 'P_1', 'P_2', 'P_2', 'P_3')), begin=c(1, 20, 23 , 3, 5, 8), end=c(5, 19, 21, 4, 9, 100), what=c('compiling A', 'compiling B', 'linking A', 'compiling C', 'compiling D', 'compiling E'))
df
> df
proc begin end what
1 P_1 1 5 compiling A
2 P_1 20 19 compiling B
3 P_1 23 21 linking A
4 P_2 3 4 compiling C
5 P_2 5 9 compiling D
6 P_3 8 100 compiling E
>
How can I do that?
Upvotes: 2
Views: 132
Reputation: 179408
Something like this?
library(ggplot2)
ggplot(df, aes(x=begin, xend=end, y=proc, yend=proc, colour=what)) +
geom_segment(size=5)
Upvotes: 4