edited long term data plot formatting

This commit is contained in:
Ben Varick 2024-01-23 15:44:23 -06:00
parent 3496d74662
commit e701534e0d
Signed by: ben
SSH Key Fingerprint: SHA256:jWnpFDAcacYM5aPFpYRqlsamlDyKNpSj3jj+k4ojtUo
3 changed files with 9 additions and 415 deletions

1
.gitignore vendored
View File

@ -3,4 +3,5 @@ data/*
figures/*
html/index.html
html/longterm_data.html
.Rhistory

File diff suppressed because one or more lines are too long

View File

@ -170,20 +170,23 @@ update_longterm_data <- function(){
group_by(weekday, hourofday, entity_id, status) %>%
summarise(count = n())
# ---- make plots
plot_all_week_days <- ggplot(data = long_term) +
plot_all_week_days <- ggplot(data = long_term %>%
left_join(. , entities, by = join_by(entity_id)) %>%
mutate(name = factor(name, levels = c("washing machine", "dryer")))) +
geom_tile(aes(x = weekday,
y = hourofday,
alpha = count,
fill = status)) +
facet_grid(entity_id ~ .) +
facet_grid(name ~ .) +
scale_y_datetime(date_breaks = "4 hours", date_labels = '%I:%M %p', minor_breaks = "2 hours", expand = expansion(mult = 0)) +
scale_x_discrete() +
scale_fill_manual(values = colors$color[2]) +
scale_fill_manual(values = colors$color[2], guide = NULL) +
theme(axis.text.x = element_text(angle = 30, vjust = 0.5)) +
labs(title = "The past year",
labs(title = "Long term trends",
subtitle = paste0("data from ",strftime(min(values$time), format = "%B %d, %Y"), " to ", strftime(run_time, format = "%B %d, %Y")),
x = "Weekday",
y = "Time of Day",
fill = NULL)
alpha = "Frequency")
# ---- generate html
render("laundry_longterm_data.Rmd",