From e701534e0d4bc626bb34d2ca050f0feb3077d555 Mon Sep 17 00:00:00 2001 From: Ben Varick Date: Tue, 23 Jan 2024 15:44:23 -0600 Subject: [PATCH] edited long term data plot formatting --- .gitignore | 1 + html/longterm_data.html | 410 ---------------------------------------- laundry_status.R | 13 +- 3 files changed, 9 insertions(+), 415 deletions(-) delete mode 100644 html/longterm_data.html diff --git a/.gitignore b/.gitignore index a436f8b..71a4590 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ data/* figures/* html/index.html +html/longterm_data.html .Rhistory diff --git a/html/longterm_data.html b/html/longterm_data.html deleted file mode 100644 index c005cf2..0000000 --- a/html/longterm_data.html +++ /dev/null @@ -1,410 +0,0 @@ - - - - - - - - - - - - - -Laundry Longterm Data - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -

updated: Wednesday 02:15 PM

-

this site updates every day

-
-

-

If you have any issues or questions, please email ben@dendroalsia.net

-

The code that I wrote to generate this website is available under the -GPLv3 license here: https://git.dendroalsia.net/ben/laundry_status

- - - - -
- - - - - - - - - - - - - - - diff --git a/laundry_status.R b/laundry_status.R index df19b5e..61ac4a7 100755 --- a/laundry_status.R +++ b/laundry_status.R @@ -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",