From 1a44fc8ee41cc3720cfeef5e519e7c180f29fde9 Mon Sep 17 00:00:00 2001 From: Ben Varick Date: Tue, 21 Nov 2023 11:24:27 -0600 Subject: [PATCH] changed colors --- laundry_status.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/laundry_status.R b/laundry_status.R index 44b4923..6629e6b 100755 --- a/laundry_status.R +++ b/laundry_status.R @@ -23,6 +23,8 @@ power_threshhold <- 10 # ---- set variables entities <- data.frame(name = c("washing machine", "dryer"), entity_id = c("washing_machine_power", "dryer_power")) +colors <- data.frame(value = c("off", "on"), color = c("#bcbcbc", "#b45f06")) + # Define a function to calculate the time difference calculateTimeAgo <- function(eventTime) { current <- Sys.time() # Get the current time @@ -85,6 +87,7 @@ update_data <- function(){ fill = status)) + scale_y_discrete(breaks = entities$entity_id, labels = entities$name) + scale_x_datetime(breaks = seq(round_date(max(values$end_time), "4 hours") - hours(24), round_date(max(values$end_time), "4 hours"), by = "4 hours"), date_labels = '%I:%M %p', date_minor_breaks = "1 hours") + + scale_fill_manual(values = colors$color) + theme(axis.text.x = element_text(angle = 30, vjust = 0.5)) + labs(title = "Last 24 hours", x = NULL, @@ -99,6 +102,7 @@ update_data <- function(){ 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") + + scale_fill_manual(values = colors$color) + theme(axis.text.x = element_text(angle = 30, vjust = 0.5)) + labs(title = "The past week", x = NULL, @@ -118,6 +122,7 @@ update_data <- function(){ 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_datetime(date_breaks = "1 day", date_labels = '%A', minor_breaks = NULL) + + scale_fill_manual(values = colors$color) + theme(axis.text.x = element_text(angle = 30, vjust = 0.5)) + labs(title = "The past week", x = "Day",