Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# daily_stats has 5 columns used by this code: date, time_spent_10/25/50/75/90
ggplot(daily_stats) +
geom_segment(aes(x = date, xend = date, y = time_spent_10, yend = time_spent_90),
size = 1, color = "#00af89") +
geom_segment(aes(x = date, xend = date, y = time_spent_25, yend = time_spent_75),
size = 2, color = "#14866d") +
# geom_ribbon(aes(x = date, ymin = time_spent_lower, ymax = time_spent_upper), alpha = 0.3) +
# geom_line(aes(x = date, y = time_spent_middle)) +
geom_label(
aes(x = date, y = time_spent_50, label = tolower(lubridate::seconds_to_period(time_spent_50))),
size = 2.5
) +
scale_x_date(expand = c(0, 0.5), date_minor_breaks = "1 day", date_breaks = "3 days", date_labels = "%b %d\n(%a)") +
scale_y_log10(label = function(x) {
y <- tolower(lubridate::seconds_to_period(round(x)))
z <- gsub(" 0[hms]", "", y)
return(z)
}, breaks = c(1, 5, 10, 30, 60, 60 * 5, 60 * 15, 60 * 60 * c(0.5, 1, 3, 6, 12))) +
coord_cartesian(ylim = c(1, 60 * 60 * 12)) +
facet_wrap(~ release, ncol = 1) +
theme_facet(panel.grid.minor.y = element_blank()) +
labs(
title = "Total time spent in Editor Tasks workflow per user per day",
x = "Date", y = "Time (logarithmic scale)",
subtitle = "Median time spent using feature since release, along with 10/25/75/90-th percentiles"
)
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.