changed axis labels on week graph

This commit is contained in:
Ben Varick 2023-11-21 08:39:10 -06:00
parent 1fbe61128e
commit 7d537bb4f1
Signed by: ben
SSH Key Fingerprint: SHA256:jWnpFDAcacYM5aPFpYRqlsamlDyKNpSj3jj+k4ojtUo

View File

@ -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")