Ticket #1890: deviant-consensus-times.R

File deviant-consensus-times.R, 788 bytes (added by karsten, 7 years ago)

Graphing code

Line 
1# Usage: Save consensus valid-after times to deviant-consensus-times.txt
2#        with lines formatted as "YYYY-MM-DD-HH-MM-SS-consensus" and run
3#        R --slave -f deviant-consensus-times.R
4library(ggplot2)
5c <- read.table("deviant-consensus-times.txt", header = FALSE,
6  stringsAsFactors = FALSE)
7c <- data.frame(
8  month = as.Date(paste(substr(c$V1, 1, 7), "-01", sep = "")),
9  datetime = as.POSIXct(paste("1971-03-", substr(c$V1, 9, 19), sep = ""),
10  format = "%Y-%m-%d-%H-%M-%S"))
11ggplot(c, aes(x = datetime, y = month)) +
12geom_point(color = "red") +
13scale_x_datetime(name = "\nDay of month and time", format = "%d") +
14scale_y_date(name = "Month\n", format = "%Y-%m") +
15opts(title = "Deviant consensuses\n")
16ggsave("deviant-consensus-times.png", width = 8, height = 6, dpi = 72)
17