-
Notifications
You must be signed in to change notification settings - Fork 1
/
hist.r
43 lines (37 loc) · 1.3 KB
/
hist.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
library(ggplot2)
library(scales)
data <- data.frame()
for (dir in c("CC", "CWO", "BlockPy", "ITAP", "PCRS")) {
for (file in c("EQ", "RED", "WatWin")) {
path <- paste0("out/", dir, "/", file, ".csv")
if (!file.exists(path)) {
print(paste("Missing:", path))
next
}
metric <- read.csv(path)
print(head(metric))
names(metric)[2] <- "Value"
metric$SubjectID <- as.character(metric$SubjectID)
metric$Metric <- if (file == "WatWin") "Watwin" else file
metric$Dataset <- dir
if (nrow(data) == 0)
data <- metric
else
data <- rbind(data, metric)
}
}
# 5x3.5
ggplot(data, aes(Value)) + geom_density(fill="gray") +
scale_x_continuous(breaks = c(0.5)) +
scale_y_continuous(name="Density") +
theme_bw() + #ggtitle("Metric Distributions") +
facet_grid(Metric ~ Dataset)
ggplot(data, aes(Value)) + geom_histogram(bins=6, aes(y=..density..)) +
scale_x_continuous(breaks = c(0, 0.5, 1)) +
scale_y_continuous(name="Density", labels=percent_format()) +
theme_bw() + #ggtitle("Metric Distributions") +
facet_grid(Metric ~ Dataset)
n <- 150
test <- data.frame(Value=runif(n*5*3,0,1),
Metric=rep(c("EQ", "RED", "Watwin"), n),
Dataset=c(rep("CC", n), rep("CWO", n), rep("BlockPy", n), rep("PCRS", n), rep("ITAP", n)))