Created
April 19, 2017 07:02
-
-
Save rasyidstat/03f31381b4ddf64041398ba7f3372337 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) %>% | |
mutate_each(funs(as.POSIXct(paste("2017-01-01", .))), -day) %>% | |
ggplot(aes(dep_time, arr_time, color=day)) + geom_point() + | |
geom_smooth(method="lm", color="steelblue") + | |
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='Departure Time', y='Arrival Time') + | |
scale_color_discrete(name="Day") + | |
scale_x_datetime(date_breaks='5 min', | |
date_labels='%H:%M') + | |
scale_y_datetime(date_breaks='5 min', | |
date_labels='%H:%M') + | |
theme(panel.grid.major.y=element_line()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment