forked from AlejoEnriquez2/GreenLightDistrict_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualization.R
432 lines (335 loc) · 18.7 KB
/
visualization.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
install.packages("ggplot2")
install.packages("dplyr")
install.packages("stats")
library(ggplot2)
library(dplyr)
library(stats)
data_file <- read.csv("data-analysis/clean-data.csv") %>%
mutate(app = ifelse(app == 1, "Skype",
ifelse(app == 2, "Slack",
ifelse(app == 3, "Discord", "Unknown"))))
data_file_2 <- data_file %>% filter(duration == 2)
data_file_8 <- data_file %>% filter(duration == 8)
## Histograms
# energy - 2 mins
hist_energy_2 <- ggplot(data = data_file_2, aes(x = app, y = energy, fill = factor(app_type))) +
geom_bar(stat = "identity", position = "dodge") +
xlab("Apps") +
ylab("Energy") +
ggtitle("Energy Consumption for Duration = 2") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#7DCEA0")) +
theme_minimal()
hist_energy_2
#energy - 8 mins
hist_energy_8 <- ggplot(data = data_file_8, aes(x = app, y = energy, fill = factor(app_type))) +
geom_bar(stat = "identity", position = "dodge") +
xlab("Apps") +
ylab("Energy") +
ggtitle("Energy Consumption for Duration = 8") +
scale_fill_manual(values = c("electron" = "#C39BD3", "web" = "#E59866")) +
theme_minimal()
hist_energy_8
# cpu - 2 mins
hist_cpu_2 <- ggplot(data = data_file_2, aes(x = app, y = cpu, fill = factor(app_type))) +
geom_bar(stat = "identity", position = "dodge") +
xlab("Apps") +
ylab("CPU") +
ggtitle("CPU Usage for Duration = 2") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#7DCEA0")) +
theme_minimal()
hist_cpu_2
# cpu - 8 mins
hist_cpu_8 <- ggplot(data = data_file_8, aes(x = app, y = cpu, fill = factor(app_type))) +
geom_bar(stat = "identity", position = "dodge") +
xlab("Apps") +
ylab("CPU") +
ggtitle("CPU Usage for Duration = 8") +
scale_fill_manual(values = c("electron" = "#C39BD3", "web" = "#E59866")) +
theme_minimal()
hist_cpu_8
# mem - 2 mins
hist_mem_2 <- ggplot(data = data_file_2, aes(x = app, y = memory, fill = factor(app_type))) +
geom_bar(stat = "identity", position = "dodge") +
xlab("Apps") +
ylab("Memory") +
ggtitle("Memory Usage for Duration = 2") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#7DCEA0")) +
theme_minimal()
hist_mem_2
# mem - 8 mins
hist_mem_8 <- ggplot(data = data_file_8, aes(x = app, y = memory, fill = factor(app_type))) +
geom_bar(stat = "identity", position = "dodge") +
xlab("Apps") +
ylab("Memory") +
ggtitle("Memory Usage for Duration = 8") +
scale_fill_manual(values = c("electron" = "#C39BD3", "web" = "#E59866")) +
theme_minimal()
hist_mem_8
# network - 2 mins
hist_net_2 <- ggplot(data = data_file_2, aes(x = app, y = network, fill = factor(app_type))) +
geom_bar(stat = "identity", position = "dodge") +
xlab("Apps") +
ylab("Network") +
ggtitle("Network Usage for Duration = 2") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#7DCEA0")) +
theme_minimal()
hist_net_2
# mem - 8 mins
hist_net_8 <- ggplot(data = data_file_8, aes(x = app, y = network, fill = factor(app_type))) +
geom_bar(stat = "identity", position = "dodge") +
xlab("Apps") +
ylab("Network") +
ggtitle("Network Usage for Duration = 8") +
scale_fill_manual(values = c("electron" = "#C39BD3", "web" = "#E59866")) +
theme_minimal()
hist_net_8
# Save the plot to the "plots" directory
ggsave("graphs/hist_energy_2.png", hist_energy_2)
ggsave("graphs/hist_energy_8.png", hist_energy_8)
ggsave("graphs/hist_cpu_2.png", hist_cpu_2)
ggsave("graphs/hist_cpu_8.png", hist_cpu_8)
ggsave("graphs/hist_mem_2.png", hist_mem_2)
ggsave("graphs/hist_mem_8.png", hist_mem_8)
ggsave("graphs/hist_net_2.png", hist_net_2)
ggsave("graphs/hist_net_8.png", hist_net_8)
## Scatter Plots
# Scatterplot for the different apps
scatter_energy_duration <- ggplot(data = data_file, aes(x = as.factor(duration), y = energy, color = app_type)) +
geom_point(size = 3) +
labs(x = "Duration (mins)", y = "Energy Consumption [J]", title = "Energy Consumption vs. Duration") +
scale_color_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_jitter()
scatter_energy_duration
ggsave("graphs/scatter/scatter_energy_duration.png", scatter_energy_duration)
# Memory
scatter_memroy_duration <- ggplot(data = data_file, aes(x = as.factor(duration), y = memory, color = app_type)) +
geom_point(size = 3) +
labs(x = "Duration (mins)", y = "Memory Usage [%]", title = "Memory Usage vs. Duration") +
scale_color_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_jitter()
scatter_memroy_duration
ggsave("graphs/scatter/scatter_memroy_duration.png", scatter_memroy_duration)
# CPU
scatter_cpu_duration <- ggplot(data = data_file, aes(x = as.factor(duration), y = cpu, color = app_type)) +
geom_point(size = 3) +
labs(x = "Duration (mins)", y = "CPU Usage [%]", title = "CPU Usage vs. Duration") +
scale_color_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_jitter()
scatter_cpu_duration
ggsave("graphs/scatter/scatter_cpu_duration.png", scatter_cpu_duration)
# Network
scatter_network_duration <- ggplot(data = data_file, aes(x = as.factor(duration), y = network, color = app_type)) +
geom_point(size = 3) +
labs(x = "Duration (mins)", y = "Number of TCP & UDP Packets", title = "Network Packets vs. Duration") +
scale_color_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_jitter()
scatter_network_duration
ggsave("graphs/scatter/scatter_network_duration.png", scatter_network_duration)
## Violin Plots
# energy consumption for Electron-based apps versus Web apps
violin_plot_energy <- ggplot(data = data_file, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "Distribution of Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A"))
violin_plot_energy
ggsave("graphs/violin/violin_plot_energy.png", violin_plot_energy)
# Box-Violin
violin_box_plot_energy <- ggplot(data = data_file, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "Distribution of Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_energy
ggsave("graphs/violin/violin_box_plot_energy.png", violin_box_plot_energy)
# Perfomance metrics
# Violin Plot for CPU Consumption
violin_plot_cpu <- ggplot(data = data_file, aes(x = app_type, y = cpu, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "CPU Usage[%]", title = "CPU Usage for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A"))
violin_plot_cpu
ggsave("graphs/violin/violin_plot_cpu.png", violin_plot_cpu)
# Box-Violin for CPU Consumption
violin_box_plot_cpu <- ggplot(data = data_file, aes(x = app_type, y = cpu, fill = app_type)) +
geom_violin() +
labs(x = "App Type",y = "CPU Usage[%]", title = "CPU Usage for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_cpu
ggsave("graphs/violin/violin_box_plot_cpu.png", violin_box_plot_cpu)
# Violin Plot for Memory Consumption
violin_plot_memory <- ggplot(data = data_file, aes(x = app_type, y = memory, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Memory Usage[%]", title = "Memory Usage[%] for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A"))
violin_plot_memory
ggsave("graphs/violin/violin_plot_memory.png", violin_plot_memory)
# Box-Violin for Memory Consumption
violin_box_plot_memory <- ggplot(data = data_file, aes(x = app_type, y = memory, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Memory Usage[%]", title = "Memory Usage[%] for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_memory
ggsave("graphs/violin/violin_box_plot_memory.png", violin_box_plot_memory)
# Violin Plot for Network Consumption
violin_plot_network <- ggplot(data = data_file, aes(x = app_type, y = network, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "TCP & UDP Packets", title = "Network Packets for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A"))
violin_plot_network
ggsave("graphs/violin/violin_plot_network.png", violin_plot_network)
# Box-Violin for Network Consumption
violin_box_plot_network <- ggplot(data = data_file, aes(x = app_type, y = network, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "TCP & UDP Packets", title = "Network Packets for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_network
ggsave("graphs/violin/violin_box_plot_network.png", violin_box_plot_network)
## 2 mins duration
# Box-Violin - energy
violin_box_plot_2_energy <- ggplot(data = data_file_2, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "Energy Consumption for Electron vs. Web Apps for 2 minutes meeting") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_2_energy
ggsave("graphs/violin/violin_box_plot_2_energy.png", violin_box_plot_2_energy)
# Box-Violin Plot for CPU Consumption (2 minutes duration)
violin_box_plot_2_cpu <- ggplot(data = data_file_2, aes(x = app_type, y = (cpu*100), fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "CPU Usage[%]", title = "CPU Usage for Electron vs. Web Apps for 2 minutes meeting") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_2_cpu
ggsave("graphs/violin/violin_box_plot_2_cpu.png", violin_box_plot_2_cpu)
# Box-Violin Plot for Memory Consumption (2 minutes duration)
violin_box_plot_2_memory <- ggplot(data = data_file_2, aes(x = app_type, y = memory, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Memory Usage[%]", title = "Memory Usage[%] for Electron vs. Web Apps for 2 minutes meeting") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_2_memory
ggsave("graphs/violin/violin_box_plot_2_memory.png", violin_box_plot_2_memory)
# Box-Violin Plot for Network Consumption (2 minutes duration)
violin_box_plot_2_network <- ggplot(data = data_file_2, aes(x = app_type, y = network, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Number of TCP & UDP Packets", title = "Network Packets for Electron vs. Web Apps for 2 minutes meeting") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_2_network
ggsave("graphs/violin/violin_box_plot_2_network.png", violin_box_plot_2_network)
## 8 mins duration
# Box-Violin - energy
violin_box_plot_8_energy <- ggplot(data = data_file_8, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "Energy Consumption for Electron vs. Web Apps for 8 minutes meeting") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_8_energy
ggsave("graphs/violin/violin_box_plot_8_energy.png", violin_box_plot_8_energy)
# Box-Violin Plot for CPU Consumption (8 minutes duration)
violin_box_plot_8_cpu <- ggplot(data = data_file_8, aes(x = app_type, y = (cpu*100), fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "CPU Usage[%]", title = "CPU Usage for Electron vs. Web Apps for 8 minutes meeting") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_8_cpu
ggsave("graphs/violin/violin_box_plot_8_cpu.png", violin_box_plot_8_cpu)
# Box-Violin Plot for Memory Consumption (8 minutes duration)
violin_box_plot_8_memory <- ggplot(data = data_file_8, aes(x = app_type, y = memory, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Memory Usage[%]", title = "Memory Usage[%] for Electron vs. Web Apps for 8 minutes meeting") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_8_memory
ggsave("graphs/violin/violin_box_plot_8_memory.png", violin_box_plot_8_memory)
# Box-Violin Plot for Network Consumption (8 minutes duration)
violin_box_plot_8_network <- ggplot(data = data_file_8, aes(x = app_type, y = network, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Number of TCP & UDP Packets", title = "Network Packets for Electron vs. Web Apps for 8 minutes meeting") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_8_network
ggsave("graphs/violin/violin_box_plot_8_network.png", violin_box_plot_8_network)
## Modes of interaction
# Energy
violin_plot_energy_audio_only <- ggplot(data = data_file_audio_only, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "AudioOnly - Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A"))
violin_plot_energy_audio_only
ggsave("graphs/violin/violin_plot_energy_audio_only.png", violin_plot_energy_audio_only)
# Box-Violin
violin_box_plot_energy_audio_only <- ggplot(data = data_file_audio_only, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "AudioOnly - Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_energy_audio_only
ggsave("graphs/violin/violin_box_plot_energy_audio_only.png", violin_box_plot_energy_audio_only)
# Energy
# Audio Video
violin_plot_energy_audio_video <- ggplot(data = data_file_audio_video, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "AudioVideo - Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A"))
violin_plot_energy_audio_video
ggsave("graphs/violin/violin_plot_energy_audio_video.png", violin_plot_energy_audio_video)
# Box-Violin
violin_box_plot_energy_audio_video <- ggplot(data = data_file_audio_video, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "AudioVideo - Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_energy_audio_video
ggsave("graphs/violin/violin_box_plot_energy_audio_video.png", violin_box_plot_energy_audio_video)
# Energy
#AudioScreen
violin_plot_energy_audio_screen <- ggplot(data = data_file_audio_screen, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "AudioScreen - Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A"))
violin_plot_energy_audio_screen
ggsave("graphs/violin/violin_plot_energy_audio_screen.png", violin_plot_energy_audio_screen)
# Box-Violin
violin_box_plot_energy_audio_screen <- ggplot(data = data_file_audio_screen, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "AudioScreen - Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_energy_audio_screen
ggsave("graphs/violin/violin_box_plot_energy_audio_screen.png", violin_box_plot_energy_audio_screen)
# Energy
#VideoScreen
violin_plot_energy_video_screen <- ggplot(data = data_file_video_screen, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "VideoScreen - Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A"))
violin_plot_energy_video_screen
ggsave("graphs/violin/violin_plot_energy_video_screen.png", violin_plot_energy_video_screen)
# Box-Violin
violin_box_plot_energy_video_screen <- ggplot(data = data_file_video_screen, aes(x = app_type, y = energy, fill = app_type)) +
geom_violin() +
labs(x = "App Type", y = "Energy Consumption [J]", title = "VideoScreen - Energy Consumption for Electron vs. Web Apps") +
scale_fill_manual(values = c("electron" = "#5DADE2", "web" = "#F1948A")) +
geom_boxplot(width=.1, alpha=.5, position=position_dodge(.9)) +
stat_summary(fun=mean, geom="point", shape="diamond", size=3, color="black")
violin_box_plot_energy_video_screen
ggsave("graphs/violin/violin_box_plot_energy_video_screen.png", violin_box_plot_energy_video_screen)