feat(graphs): new dimensions and layour for cpu, now for real
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
source("common.R")
|
source("common.R")
|
||||||
|
|
||||||
parser <- fig_parser(description = "Receiver CPU bar chart")
|
parser <- fig_parser(description = "Receiver CPU bar chart")
|
||||||
|
parser$add_argument("--ymin", type = "double")
|
||||||
|
parser$add_argument("--ymax", type = "double")
|
||||||
parser$add_argument("--ystep", type = "double",
|
parser$add_argument("--ystep", type = "double",
|
||||||
help = "y-axis major tick spacing (omit = auto)")
|
help = "y-axis major tick spacing (omit = auto)")
|
||||||
args <- parser$parse_args()
|
args <- parser$parse_args()
|
||||||
@@ -17,10 +19,18 @@ p <- ggplot(runs, aes(x = solution, y = mean_pct, fill = solution)) +
|
|||||||
geom_errorbar(aes(ymin = mean_pct - sd_pct, ymax = mean_pct + sd_pct),
|
geom_errorbar(aes(ymin = mean_pct - sd_pct, ymax = mean_pct + sd_pct),
|
||||||
width = 0.2) +
|
width = 0.2) +
|
||||||
scale_fill_manual(values = LABEL_COLORS, guide = "none") +
|
scale_fill_manual(values = LABEL_COLORS, guide = "none") +
|
||||||
labs(x = NULL, y = paste0("Average CPU usage (", pct_sign(), ")")) +
|
labs(x = NULL, y = paste0("Average CPU (", pct_sign(), ")")) +
|
||||||
theme_paper()
|
theme_paper() +
|
||||||
|
theme(axis.text.x = element_text(angle = 45, hjust = 1),
|
||||||
|
plot.margin = margin(2, 4, 0, 2))
|
||||||
|
|
||||||
if (!is.null(args$ystep)) {
|
if (!is.null(args$ymax)) {
|
||||||
|
ymin <- if (is.null(args$ymin)) 0 else args$ymin
|
||||||
|
p <- p + coord_cartesian(ylim = c(ymin, args$ymax))
|
||||||
|
if (!is.null(args$ystep)) {
|
||||||
|
p <- p + scale_y_continuous(breaks = seq(ymin, args$ymax, args$ystep))
|
||||||
|
}
|
||||||
|
} else if (!is.null(args$ystep)) {
|
||||||
p <- p + scale_y_continuous(breaks = scales::breaks_width(args$ystep))
|
p <- p + scale_y_continuous(breaks = scales::breaks_width(args$ystep))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
source("common.R")
|
source("common.R")
|
||||||
|
|
||||||
parser <- fig_parser(description = "Sender CPU bar chart")
|
parser <- fig_parser(description = "Sender CPU bar chart")
|
||||||
|
parser$add_argument("--ymin", type = "double")
|
||||||
|
parser$add_argument("--ymax", type = "double")
|
||||||
parser$add_argument("--ystep", type = "double",
|
parser$add_argument("--ystep", type = "double",
|
||||||
help = "y-axis major tick spacing (omit = auto)")
|
help = "y-axis major tick spacing (omit = auto)")
|
||||||
args <- parser$parse_args()
|
args <- parser$parse_args()
|
||||||
@@ -17,10 +19,18 @@ p <- ggplot(runs, aes(x = solution, y = mean_pct, fill = solution)) +
|
|||||||
geom_errorbar(aes(ymin = mean_pct - sd_pct, ymax = mean_pct + sd_pct),
|
geom_errorbar(aes(ymin = mean_pct - sd_pct, ymax = mean_pct + sd_pct),
|
||||||
width = 0.2) +
|
width = 0.2) +
|
||||||
scale_fill_manual(values = LABEL_COLORS, guide = "none") +
|
scale_fill_manual(values = LABEL_COLORS, guide = "none") +
|
||||||
labs(x = NULL, y = paste0("Average CPU usage (", pct_sign(), ")")) +
|
labs(x = NULL, y = paste0("Average CPU (", pct_sign(), ")")) +
|
||||||
theme_paper()
|
theme_paper() +
|
||||||
|
theme(axis.text.x = element_text(angle = 45, hjust = 1),
|
||||||
|
plot.margin = margin(2, 4, 0, 2))
|
||||||
|
|
||||||
if (!is.null(args$ystep)) {
|
if (!is.null(args$ymax)) {
|
||||||
|
ymin <- if (is.null(args$ymin)) 0 else args$ymin
|
||||||
|
p <- p + coord_cartesian(ylim = c(ymin, args$ymax))
|
||||||
|
if (!is.null(args$ystep)) {
|
||||||
|
p <- p + scale_y_continuous(breaks = seq(ymin, args$ymax, args$ystep))
|
||||||
|
}
|
||||||
|
} else if (!is.null(args$ystep)) {
|
||||||
p <- p + scale_y_continuous(breaks = scales::breaks_width(args$ystep))
|
p <- p + scale_y_continuous(breaks = scales::breaks_width(args$ystep))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user