edited long term data plot formatting
This commit is contained in:
parent
3496d74662
commit
e701534e0d
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,5 @@ data/*
|
|||||||
figures/*
|
figures/*
|
||||||
|
|
||||||
html/index.html
|
html/index.html
|
||||||
|
html/longterm_data.html
|
||||||
.Rhistory
|
.Rhistory
|
||||||
|
File diff suppressed because one or more lines are too long
@ -170,20 +170,23 @@ update_longterm_data <- function(){
|
|||||||
group_by(weekday, hourofday, entity_id, status) %>%
|
group_by(weekday, hourofday, entity_id, status) %>%
|
||||||
summarise(count = n())
|
summarise(count = n())
|
||||||
# ---- make plots
|
# ---- 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,
|
geom_tile(aes(x = weekday,
|
||||||
y = hourofday,
|
y = hourofday,
|
||||||
alpha = count,
|
alpha = count,
|
||||||
fill = status)) +
|
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_y_datetime(date_breaks = "4 hours", date_labels = '%I:%M %p', minor_breaks = "2 hours", expand = expansion(mult = 0)) +
|
||||||
scale_x_discrete() +
|
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)) +
|
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",
|
x = "Weekday",
|
||||||
y = "Time of Day",
|
y = "Time of Day",
|
||||||
fill = NULL)
|
alpha = "Frequency")
|
||||||
|
|
||||||
# ---- generate html
|
# ---- generate html
|
||||||
render("laundry_longterm_data.Rmd",
|
render("laundry_longterm_data.Rmd",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user