Skip to content

Instantly share code, notes, and snippets.

@vicentebolea
Last active June 28, 2018 09:41
Show Gist options
  • Select an option

  • Save vicentebolea/bc57cdeec659b05c7382077d9963898d to your computer and use it in GitHub Desktop.

Select an option

Save vicentebolea/bc57cdeec659b05c7382077d9963898d to your computer and use it in GitHub Desktop.
Generates a time series plot for Parallel Tasks
require(ggplot2)
require(scales)
## Variables to be set
FONT_SIZE_X=12
FONT_SIZE_Y=5
## Source code
args = commandArgs(trailingOnly=TRUE)
df = read.csv("stdin")
df$start = as.POSIXct(df$start_time, format="%H:%M:%S")
df$end = as.POSIXct(df$end_time, format="%H:%M:%S")
p <- ggplot() +
geom_rect(data=df, aes(ymin=task_name, ymax=task_name, xmin=start, xmax=end),color = "red",size = 1) +
scale_x_datetime(date_breaks= "20 sec", date_minor_breaks = "1 sec", date_labels = "%M:%S") +
theme(text= element_text(size=FONT_SIZE_Y)) +
theme(axis.text.x = element_text(size=FONT_SIZE_X))
ggsave(file=args[1], plot=p, width=15, height=15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment