|
@@ -0,0 +1,27 @@
|
|
1
|
+library(reticulate)
|
|
2
|
+library(ggplot2)
|
|
3
|
+library(dplyr)
|
|
4
|
+theme_set(theme_bw())
|
|
5
|
+use_virtualenv("../venv/")
|
|
6
|
+
|
|
7
|
+p <- import("pandas")
|
|
8
|
+sns <- import("seaborn")
|
|
9
|
+cbp <- as.character(p$Series(sns$color_palette("colorblind", as.integer(9))$as_hex()))
|
|
10
|
+aggdf <- p$read_pickle("../data/9-clusters.agg.pkl")
|
|
11
|
+aggdf <- as.data.frame(aggdf)
|
|
12
|
+aggdf$cluster <- factor(aggdf$cluster)
|
|
13
|
+str(aggdf)
|
|
14
|
+
|
|
15
|
+ggplot(aggdf, aes(y = kwh_tot_mean, x = cluster)) + geom_boxplot()
|
|
16
|
+
|
|
17
|
+ggplot(aggdf, aes(x = read_time, y = kwh_tot_mean, color = cluster)) +
|
|
18
|
+ geom_line() + facet_grid(cluster ~ .) +
|
|
19
|
+ labs(title = "Cluster behaviour over full year", x = "Date and time", y = "kwh") +
|
|
20
|
+ scale_color_manual(values = cbp)
|
|
21
|
+
|
|
22
|
+midjan <- filter(aggdf, read_time > as.POSIXct("2017-01-15"), read_time <= as.POSIXct("2017-01-21"))
|
|
23
|
+
|
|
24
|
+ggplot(midjan, aes(x = read_time, y = kwh_tot_mean, color = cluster)) +
|
|
25
|
+ geom_line() + facet_grid(cluster ~ .) +
|
|
26
|
+ labs(title = "Cluster behaviour over third week of January", x = "Date and time", y = "kwh") +
|
|
27
|
+ scale_color_manual(values = cbp)
|