-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plots enhancement #28
base: main
Are you sure you want to change the base?
Conversation
Ainda preciso analisar o que é ou não específico dos experimentos |
readr::write_csv(data_with_auto_scaling, here::here(configs$output_file)) | ||
configs <- generate_output_filepaths(configs) | ||
|
||
readr::write_csv(data_with_auto_scaling, here::here(configs$policy_filepath)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acho o nome policy_filepath
pouco sugestivo. Talvez simulation_filepath
seja mais adequado.
geom_text(aes(x = min(datetime), y = lower_bound-2, label = "Lower Bound"), size = 2, color = "blue") | ||
|
||
} else if (startsWith(title, "Target Tracking")) { | ||
# Draw a line for target threshold | ||
target <- policy_parameters$target_value | ||
|
||
plot <- plot + | ||
geom_hline(yintercept = target, color = "red") + | ||
geom_text(aes(x = 120, y = target+2, label = "Target threshold"), size = 3, color = "red") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geom_text(aes(x = 120, y = target+2, label = "Target threshold"), size = 3, color = "red") | |
geom_text(aes(x = min(datetime), y = target+2, label = "Target threshold"), size = 3, color = "red") |
geom_text(aes(x = min(datetime),y = upper_bound+2, label = "Upper Bound"), size = 2, color = "red") + | ||
geom_hline(yintercept = lower_bound, color = "blue") + | ||
geom_text(aes(x = 70, y = lower_bound-2, label = "Lower Bound"), size = 3, color = "blue") | ||
|
||
} else if (policy_name == "target_tracking") { | ||
geom_text(aes(x = min(datetime), y = lower_bound-2, label = "Lower Bound"), size = 2, color = "blue") | ||
|
||
} else if (startsWith(title, "Target Tracking")) { | ||
# Draw a line for target threshold | ||
target <- policy_parameters$target_value | ||
|
||
plot <- plot + | ||
geom_hline(yintercept = target, color = "red") + | ||
geom_text(aes(x = 120, y = target+2, label = "Target threshold"), size = 3, color = "red") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ao invés de no y colocar valor + constante
, dá uma olhada no parâmetro nudge_y, ele faz esse tipo de deslocamento.
labs(y = "Cores", x = "Tempo (min)") | ||
labs(y = "Cores", x = "Time (hour)", color = "") + | ||
theme(legend.position = "top", legend.direction = "horizontal") + | ||
scale_x_datetime(date_breaks = date_break, date_labels = "%H:%M") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eu adicionaria aqui linhas horizontais com a quantidade mínima e máxima de cores.
# Creates two plots for cores and system utilization over time comparing | ||
# real and simulation results. | ||
title <- get_title(data, configs$policies$use) | ||
date_break <- get_plot_date_break(configs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
date_break <- get_plot_date_break(configs) | |
date_break <- ifelse(is.null(configs$plot_scale_datetime), "1 hour", configs$plot_scale_datetime) |
Acho meio desnecessário criar uma função que faz apenas um if...else.
get_plot_date_break <- function(configs) { | ||
if (is.null(configs$plot_scale_datetime)) { | ||
date_break <- "1 hour" | ||
} else { | ||
date_break <- configs$plot_scale_datetime | ||
} | ||
|
||
return (date_break) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_plot_date_break <- function(configs) { | |
if (is.null(configs$plot_scale_datetime)) { | |
date_break <- "1 hour" | |
} else { | |
date_break <- configs$plot_scale_datetime | |
} | |
return (date_break) | |
} |
|
||
# Generate output base filepath | ||
output_basename <- str_split(basename(configs$input_file), '[.]')[[1]][1] | ||
output_base_filepath <- paste(configs$output_directory, output_basename, sep='') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pelo que entendi isso constrói um path, então o ideal é utilizar file.path
, porque ai não depende do usuário colocar o separador correto.
No description provided.