Created
April 19, 2017 07:01
-
-
Save rasyidstat/072d050c360659f710c6f83b90120e9e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_ho %>% | |
select(-date, -day) %>% | |
gather(key = type, value = time) %>% | |
mutate(time = as.POSIXct(paste("2017-01-01", time))) %>% | |
ggplot(aes(time, fill=type)) + geom_density(color=NA, alpha=0.4) + | |
theme_ipsum_rc(grid="X") + | |
labs(title="When do I depart and arrive from home to office?", | |
subtitle=paste(month(min(df_ho$date), label=T), year(min(df_ho$date)), '-', | |
month(max(df_ho$date), label=T), year(max(df_ho$date))), | |
caption=paste("Number of trips from home to main office:", nrow(df_ho)), | |
x=NULL, y=NULL) + | |
scale_fill_discrete(name="", labels=c('Arrival','Departure')) + | |
scale_x_datetime(limits=c(as.POSIXct(paste("2017-01-01", "07:35")), | |
as.POSIXct(paste("2017-01-01", "08:40"))), | |
date_breaks='5 min', | |
date_labels='%H:%M') + | |
theme(legend.justification=c(1,1), legend.position=c(1,1), | |
panel.grid.major=element_blank(), | |
panel.grid.minor=element_blank(), | |
axis.text.y=element_blank()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment