123456789101112131415161718192021222324252627 |
- library(reticulate)
- library(ggplot2)
- library(dplyr)
- theme_set(theme_bw())
- use_virtualenv("../venv/")
-
- p <- import("pandas")
- sns <- import("seaborn")
- cbp <- as.character(p$Series(sns$color_palette("colorblind", as.integer(9))$as_hex()))
- aggdf <- p$read_pickle("../data/9-clusters.agg.pkl")
- aggdf <- as.data.frame(aggdf)
- aggdf$cluster <- factor(aggdf$cluster)
- str(aggdf)
-
- ggplot(aggdf, aes(y = kwh_tot_mean, x = cluster)) + geom_boxplot()
-
- ggplot(aggdf, aes(x = read_time, y = kwh_tot_mean, color = cluster)) +
- geom_line() + facet_grid(cluster ~ .) +
- labs(title = "Cluster behaviour over full year", x = "Date and time", y = "kwh") +
- scale_color_manual(values = cbp)
-
- midjan <- filter(aggdf, read_time > as.POSIXct("2017-01-15"), read_time <= as.POSIXct("2017-01-21"))
-
- ggplot(midjan, aes(x = read_time, y = kwh_tot_mean, color = cluster)) +
- geom_line() + facet_grid(cluster ~ .) +
- labs(title = "Cluster behaviour over third week of January", x = "Date and time", y = "kwh") +
- scale_color_manual(values = cbp)
|