Skip to content

Commit 69d53b9

Browse files
committed
Modify the behaves of this script
- Use exact size as demanded in output - Update the grouping of items (grouped now by metrics instead of experiment) - Changed labels, font family, font size, title, subtitle etc.
1 parent 344f7d7 commit 69d53b9

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

R/generate_box_plots.R

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ experiment_names <- c(
2323
"rgbe3" = "RGB-R_RGB-G_RGB-B_DVS"
2424
)
2525

26+
experiment_ids <- c(
27+
"o-bs-tf_hsv" = "01",
28+
"o-bs-tf" = "02",
29+
"o-tf-o_hsv" = "03",
30+
"o-tf-o" = "04",
31+
"original_bg-sub_temp_filter_rgb" = "05",
32+
"original_bg-sub_temp-filter_hsv" = "06",
33+
"original_bg-sub_temp-filter" = "07",
34+
"original_hsv" = "08",
35+
"original" = "09",
36+
"rgbe3" = "10"
37+
)
38+
2639

2740

2841
colors = c("#FFFFFF" ,"#00BFC4" ,"#C77CFF", "#7CAE00" ,"#F8766D")
@@ -56,6 +69,7 @@ for (file in files) {
5669
df <- do.call(rbind, df_list)
5770
df <- add_filename_column(df)
5871
df$ExperimentName <- experiment_names[df$Filename]
72+
df$ExperimentID <- experiment_ids[df$Filename]
5973

6074
library(ggplot2)
6175

@@ -87,25 +101,25 @@ create_boxplot <- function(data, file_column, value_column, color, xlabel = "Exp
87101
vjust = -0.5,
88102
position = position_dodge(width = 0.75),
89103
show.legend = FALSE) +
90-
labs(title = "Boxplot for Each File", x = xlabel, y = ylabel) +
104+
labs(title = paste0("Distribution of ",ylabel," scores"), x = xlabel, y = ylabel) +
91105
theme_minimal() +
92-
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1))
106+
theme(plot.title = element_text(size=10))
93107

94108
# Print the boxplot
95109
return(p)
96110
}
97111

98112

99113

100-
factor <- 1
101-
p <- create_boxplot(df, "ExperimentName", "Value",color, ylabel = ylabel)
114+
height_factor <- 1
115+
width_size <- 8.50714756389
116+
p <- create_boxplot(df, "ExperimentID", "Value",color, ylabel = ylabel)
102117
ggsave(
103118
filename = file.path("visualizations", "boxplots", paste0(parameter, ".png")),
104119
plot = p,
105-
width = 21 * factor,
106-
height = 16 * factor,
120+
width = width_size,
121+
height = width_size * height_factor,
107122
units = "cm",
108-
dpi = 450
109123
)
110124
cat("Saved: ", parameter, "\n")
111125

0 commit comments

Comments
 (0)