Skip to content
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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Plots enhancement #28

wants to merge 8 commits into from

Conversation

kmmelcher
Copy link
Member

No description provided.

@kmmelcher kmmelcher requested a review from issilva5 August 1, 2022 12:55
@kmmelcher
Copy link
Member Author

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))
Copy link
Collaborator

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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")

Comment on lines +36 to 46
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")
Copy link
Collaborator

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")
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Comment on lines +84 to 92
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)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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='')
Copy link
Collaborator

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.

@issilva5 issilva5 marked this pull request as ready for review August 8, 2022 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants