Skip to content

Instantly share code, notes, and snippets.

@hrbrmstr
Created February 16, 2017 03:02
Show Gist options
  • Save hrbrmstr/453db36d1d3fc01c0a72bcc6f6312845 to your computer and use it in GitHub Desktop.
Save hrbrmstr/453db36d1d3fc01c0a72bcc6f6312845 to your computer and use it in GitHub Desktop.
library(ggalt)
library(hrbrthemes) # github
library(tidyverse)
jsonlite::fromJSON("[[0,0,0],[0,1,0],[0,2,0],[0,3,0],[0,4,0],[0,5,0],[0,6,0],[0,7,5],[0,8,0],[0,9,1],[0,10,2],[0,11,3],[0,12,1],[0,13,0],[0,14,0],[0,15,0],[0,16,1],[0,17,2],[0,18,1],[0,19,2],[0,20,2],[0,21,0],[0,22,1],[0,23,0],[1,0,0],[1,1,0],[1,2,0],[1,3,0],[1,4,0],[1,5,0],[1,6,1],[1,7,0],[1,8,0],[1,9,0],[1,10,1],[1,11,2],[1,12,2],[1,13,2],[1,14,0],[1,15,0],[1,16,0],[1,17,0],[1,18,0],[1,19,0],[1,20,0],[1,21,0],[1,22,3],[1,23,1],[2,0,0],[2,1,0],[2,2,0],[2,3,0],[2,4,0],[2,5,0],[2,6,0],[2,7,0],[2,8,0],[2,9,0],[2,10,2],[2,11,2],[2,12,0],[2,13,1],[2,14,1],[2,15,0],[2,16,1],[2,17,1],[2,18,2],[2,19,0],[2,20,1],[2,21,3],[2,22,1],[2,23,0],[3,0,0],[3,1,0],[3,2,0],[3,3,0],[3,4,0],[3,5,0],[3,6,0],[3,7,0],[3,8,0],[3,9,0],[3,10,0],[3,11,4],[3,12,0],[3,13,0],[3,14,0],[3,15,0],[3,16,1],[3,17,2],[3,18,0],[3,19,0],[3,20,0],[3,21,0],[3,22,0],[3,23,0],[4,0,0],[4,1,1],[4,2,0],[4,3,0],[4,4,0],[4,5,0],[4,6,0],[4,7,1],[4,8,0],[4,9,0],[4,10,0],[4,11,0],[4,12,0],[4,13,0],[4,14,0],[4,15,0],[4,16,0],[4,17,1],[4,18,0],[4,19,0],[4,20,0],[4,21,0],[4,22,0],[4,23,0],[5,0,0],[5,1,0],[5,2,0],[5,3,0],[5,4,0],[5,5,0],[5,6,0],[5,7,0],[5,8,2],[5,9,0],[5,10,1],[5,11,1],[5,12,1],[5,13,4],[5,14,1],[5,15,1],[5,16,1],[5,17,0],[5,18,1],[5,19,0],[5,20,0],[5,21,1],[5,22,0],[5,23,0],[6,0,0],[6,1,0],[6,2,0],[6,3,0],[6,4,0],[6,5,0],[6,6,0],[6,7,2],[6,8,1],[6,9,3],[6,10,1],[6,11,0],[6,12,2],[6,13,1],[6,14,0],[6,15,0],[6,16,0],[6,17,0],[6,18,0],[6,19,0],[6,20,0],[6,21,0],[6,22,0],[6,23,0]]") %>%
as_tibble() %>%
setNames(c("day", "hour", "ct")) %>%
filter(ct != 0) %>%
select(-ct) %>%
arrange(day,hour) %>%
group_by(day) %>%
do(data_frame(start=range(.$hour)[1], end=range(.$hour)[2])) %>%
ungroup() %>%
mutate(day=as.character(day)) %>%
ggplot(aes(x=start, xend=end, y=day)) +
geom_dumbbell(size=3, color="#e3e2e1",
colour_x = "#5b8124", colour_xend = "#bad744",
dot_guide=TRUE, dot_guide_size=0.15) +
scale_x_continuous(breaks=c(seq(0, 23, 4), 23), limits=c(0,23),
labels=sprintf("%02d:00", c(seq(0, 23, 4), 23))) +
scale_y_discrete(breaks=0:6, labels=c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")) +
labs(x=NULL, y=NULL, title="GitHub Working Hours for ggalt") +
theme_ipsum(grid="X")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment