Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.