From 7d537bb4f143778920abcfdb4475dcea4f88e453 Mon Sep 17 00:00:00 2001 From: Ben Varick Date: Tue, 21 Nov 2023 08:39:10 -0600 Subject: [PATCH] changed axis labels on week graph --- laundry_status.R | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/laundry_status.R b/laundry_status.R index 49b61cd..5b1bec6 100755 --- a/laundry_status.R +++ b/laundry_status.R @@ -76,20 +76,6 @@ update_data <- function(){ current_status[[entity]] <- ifelse(values %>% filter(entity_id %in% entity) %>% tail(1) %>% pull(value) > power_threshhold, "on", "off") } - plot_1week <- ggplot(data = values) + - geom_tile(aes(x = time + seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))/2), - y = entity_id, - width = seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))), - height = 0.5, - fill = status)) + - scale_y_discrete(breaks = entities$entity_id, labels = entities$name) + - scale_x_datetime(date_breaks = "24 hours", date_labels = '%A', date_minor_breaks = "6 hours") + - theme(axis.text.x = element_text(angle = 30, vjust = 0.5)) + - labs(title = "The past week", - x = NULL, - y = NULL, - fill = NULL) - plot_1day <- ggplot(data = values %>% filter(time >= max(values$end_time) - hours(24))) + geom_tile(aes(x = time + seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))/2), y = entity_id, @@ -104,6 +90,21 @@ update_data <- function(){ y = NULL, fill = NULL) + plot_1week <- ggplot(data = values) + + geom_tile(aes(x = time + seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))/2), + y = entity_id, + width = seconds(round(as.numeric(difftime(end_time, time, unit = "secs")))), + height = 0.5, + fill = status)) + + scale_y_discrete(breaks = entities$entity_id, labels = entities$name) + + scale_x_datetime(date_breaks = "1 day", date_labels = '%A', date_minor_breaks = "4 hours") + + theme(axis.text.x = element_text(angle = 30, vjust = 0.5)) + + labs(title = "The past week", + x = NULL, + y = NULL, + fill = NULL) + + render("laundry_status.Rmd", output_dir = "html", output_file = "index.html")