plot styling
This commit is contained in:
parent
60be7f97ac
commit
c404037d49
@ -1,12 +1,25 @@
|
|||||||
library("mosaic")
|
library("mosaic")
|
||||||
library("dplyr")
|
library("dplyr")
|
||||||
library("DBI")
|
library("DBI")
|
||||||
|
library("tikzDevice") # Add this line to include the tikzDevice library
|
||||||
|
library("colorspace")
|
||||||
|
library("heatmaply")
|
||||||
|
library("RColorBrewer")
|
||||||
|
|
||||||
args = commandArgs(trailingOnly=TRUE)
|
args = commandArgs(trailingOnly=TRUE)
|
||||||
|
|
||||||
|
TOOL_TRANSLATION <- list(
|
||||||
|
feedgeneration100 = "evolution",
|
||||||
|
frafl = "coverage",
|
||||||
|
random = "random",
|
||||||
|
stgwoet = "FRET"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
KNOWN_WCRT <- list(
|
KNOWN_WCRT <- list(
|
||||||
waters_seq_bytes=219542, # via INSERT_WC
|
waters_seq_bytes=212252, # via INSERT_WC
|
||||||
waters_seq_int=219542, # via INSERT_WC + manual interrupt
|
waters_seq_int=0, # via INSERT_WC + manual interrupt
|
||||||
|
#waters_seq_int=219542, # via INSERT_WC + manual interrupt
|
||||||
waters_seq_full=219542,# via INSERT_WC + manual interrupt
|
waters_seq_full=219542,# via INSERT_WC + manual interrupt
|
||||||
waters_seq_unsync_full=234439,# via INSERT_WC + manual interrupt
|
waters_seq_unsync_full=234439,# via INSERT_WC + manual interrupt
|
||||||
polycopter_seq_dataflow_full=343493, # via INSERT_WC + manual interrupt
|
polycopter_seq_dataflow_full=343493, # via INSERT_WC + manual interrupt
|
||||||
@ -15,15 +28,48 @@ KNOWN_WCRT <- list(
|
|||||||
release_seq_full=645885 # via INSERT_WC + manual interrupt
|
release_seq_full=645885 # via INSERT_WC + manual interrupt
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# STATIC_WCRT <- list(
|
||||||
|
# waters_seq_bytes=256632,
|
||||||
|
# waters_seq_int=256632,
|
||||||
|
# waters_seq_full=256632,
|
||||||
|
# waters_seq_unsync_full=272091,
|
||||||
|
# polycopter_seq_dataflow_full=373628,
|
||||||
|
# polycopter_seq_dataflow_int=373628,
|
||||||
|
# release_seq_int=921360,
|
||||||
|
# release_seq_full=921360
|
||||||
|
# )
|
||||||
|
|
||||||
STATIC_WCRT <- list(
|
STATIC_WCRT <- list(
|
||||||
waters_seq_bytes=256632,
|
waters_seq_bytes=0,
|
||||||
waters_seq_int=256632,
|
waters_seq_int=0,
|
||||||
waters_seq_full=256632,
|
waters_seq_full=0,
|
||||||
waters_seq_unsync_full=272091,
|
waters_seq_unsync_full=0,
|
||||||
polycopter_seq_dataflow_full=373628,
|
polycopter_seq_dataflow_full=0,
|
||||||
polycopter_seq_dataflow_int=373628,
|
polycopter_seq_dataflow_int=0,
|
||||||
release_seq_int=921360,
|
release_seq_int=0,
|
||||||
release_seq_full=921360
|
release_seq_full=0
|
||||||
|
)
|
||||||
|
|
||||||
|
MIN_Y <- list(
|
||||||
|
waters_seq_bytes=5250,
|
||||||
|
waters_seq_int=6000,
|
||||||
|
waters_seq_full=5250,
|
||||||
|
waters_seq_unsync_full=0,
|
||||||
|
polycopter_seq_dataflow_full=4000,
|
||||||
|
polycopter_seq_dataflow_int=4000,
|
||||||
|
release_seq_int=16500,
|
||||||
|
release_seq_full=16000
|
||||||
|
)
|
||||||
|
|
||||||
|
LEG_POS <- list(
|
||||||
|
waters_seq_bytes="bottomright",
|
||||||
|
waters_seq_int="bottomright",
|
||||||
|
waters_seq_full="bottomright",
|
||||||
|
waters_seq_unsync_full="bottomright",
|
||||||
|
polycopter_seq_dataflow_full="bottomright",
|
||||||
|
polycopter_seq_dataflow_int="bottomright",
|
||||||
|
release_seq_int="bottomright",
|
||||||
|
release_seq_full="bottomright"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Read the first command line argument as an sqlite file
|
# Read the first command line argument as an sqlite file
|
||||||
@ -52,9 +98,15 @@ ml2lines <- function(ml, casename) {
|
|||||||
return(lines)
|
return(lines)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BREW=RdYlGn(4)
|
||||||
|
# BREW=Spectral(4)
|
||||||
|
|
||||||
draw_plot <- function(data, casename) {
|
draw_plot <- function(data, casename) {
|
||||||
MY_COLORS <- c("green", "blue", "red", "magenta", "orange", "cyan", "pink", "gray", "orange", "black", "yellow","brown")
|
# evo, cov, random, fret
|
||||||
LEGEND_POS="bottomright"
|
MY_COLORS <- c(BREW[[3]], BREW[[2]], BREW[[1]], BREW[[4]], "cyan", "pink", "gray", "orange", "black", "yellow","brown")
|
||||||
|
# MY_COLORS <- c("orange", "blue", "red", "green", "orange", "cyan", "pink", "gray", "orange", "black", "yellow","brown")
|
||||||
|
# MY_COLORS <- c("green", "blue", "red", "magenta", "orange", "cyan", "pink", "gray", "orange", "black", "yellow","brown")
|
||||||
|
LEGEND_POS=LEG_POS[[casename]]
|
||||||
|
|
||||||
ISNS_PER_US = (10**3)/(2**5)
|
ISNS_PER_US = (10**3)/(2**5)
|
||||||
|
|
||||||
@ -83,47 +135,53 @@ draw_plot <- function(data, casename) {
|
|||||||
|
|
||||||
# draw limits
|
# draw limits
|
||||||
max_x <- max(sapply(data, function(tbl) max(tbl$timestamp, na.rm = TRUE)))
|
max_x <- max(sapply(data, function(tbl) max(tbl$timestamp, na.rm = TRUE)))
|
||||||
|
max_x <- min(max_x, 16) # quick fix, cap to 16h
|
||||||
max_y <- max(wcrt,max(sapply(data, function(tbl) max(tbl$max, na.rm = TRUE))))
|
max_y <- max(wcrt,max(sapply(data, function(tbl) max(tbl$max, na.rm = TRUE))))
|
||||||
min_y <- min(sapply(data, function(tbl) min(tbl$min, na.rm = TRUE)))
|
min_y <- min(sapply(data, function(tbl) min(tbl$min, na.rm = TRUE)))
|
||||||
|
min_y <- max(min_y, MIN_Y[[casename]])
|
||||||
|
|
||||||
# draw static wcrt
|
# draw static wcrt
|
||||||
max_y <- max(max_y, static_wcrt)
|
max_y <- max(max_y, static_wcrt)
|
||||||
|
|
||||||
# plot setup
|
# plot setup
|
||||||
h_ = 380
|
h_ = 300
|
||||||
w_ = h_*4/3
|
w_ = h_*4/3
|
||||||
png(file=sprintf("%s/sql_%s.png", args[2],casename), width=w_, height=h_)
|
# png(file=sprintf("%s/sql_%s.png", args[2],casename), width=w_, height=h_) # Modify this line to use tikzDevice
|
||||||
|
# tikz(file=sprintf("%s/sql_%s.tex", args[2],casename), width=w_/72, height=h_/72) # Modify this line to use tikzDevice
|
||||||
|
# png(file=sprintf("%s/sql_%s_wide.png", args[2],casename), width=w_*2, height=h_) # Modify this line to use tikzDevice
|
||||||
|
tikz(file=sprintf("%s/sql_%s_wide.tex", args[2],casename), width=(w_*2)/72, height=h_/72) # Modify this line to use tikzDevice
|
||||||
par(mar=c(4,4,1,1))
|
par(mar=c(4,4,1,1))
|
||||||
par(oma=c(0,0,0,0))
|
par(oma=c(0,0,0,0))
|
||||||
plot(c(0,max_x),c(min_y,max_y), col='white', xlab="Time [h]", ylab="WCRT estimate [us]", pch='.')
|
plot(c(0,max_x),c(min_y,max_y), col='white', xlab="Time [h]", ylab="WCRT estimate [µs]", pch='.')
|
||||||
|
|
||||||
# plot data
|
# plot data
|
||||||
for (n in seq_len(length(data))) {
|
for (n in seq_len(length(data))) {
|
||||||
d <- data[[n]]
|
d <- data[[n]]
|
||||||
malines = ml2lines(d[c('max','timestamp')])
|
malines = ml2lines(d[c('max','timestamp')])
|
||||||
lines(malines, col=MY_COLORS[[n]], lty='dashed')
|
lines(malines, col=MY_COLORS[[n]], lty='solid', lwd=2) # Increase line width
|
||||||
medlines = ml2lines(d[c('median','timestamp')])
|
medlines = ml2lines(d[c('median','timestamp')])
|
||||||
lines(medlines, col=MY_COLORS[[n]], lty='solid')
|
lines(medlines, col=MY_COLORS[[n]], lty='dashed', lwd=2) # Increase line width
|
||||||
milines = ml2lines(d[c('min','timestamp')])
|
# milines = ml2lines(d[c('min','timestamp')])
|
||||||
lines(milines, col=MY_COLORS[[n]], lty='dashed')
|
# lines(milines, col=MY_COLORS[[n]], lty='dashed', lwd=2) # Increase line width
|
||||||
}
|
}
|
||||||
|
|
||||||
legend_names <- names(data)
|
legend_names <- sapply(names(data), function(n) TOOL_TRANSLATION[[n]])
|
||||||
legend_colors <- c(MY_COLORS[1:length(data)],"black","black")
|
legend_colors <- c(MY_COLORS[1:length(data)],"grey","grey")
|
||||||
legend_styles <- c(rep("solid",length(data)),"dotted","dashed")
|
legend_styles <- c(rep("solid",length(data)),"dotted","dashed")
|
||||||
|
|
||||||
if (wcrt > 0) {
|
if (wcrt > 0) {
|
||||||
abline(h=wcrt, col='black', lty='dotted')
|
abline(h=wcrt, col='grey', lty='dotted', lwd=3)
|
||||||
legend_names <- c(legend_names, "WCRT")
|
legend_names <- c(legend_names, "WCRT")
|
||||||
}
|
}
|
||||||
if (static_wcrt > 0) {
|
if (static_wcrt > 0) {
|
||||||
abline(h=static_wcrt, col='black', lty='dashed')
|
abline(h=static_wcrt, col='grey', lty='dashed', lwd=3)
|
||||||
legend_names <- c(legend_names, "static bound")
|
legend_names <- c(legend_names, "static bound")
|
||||||
}
|
}
|
||||||
|
|
||||||
legend(LEGEND_POS, legend=legend_names,#"bottomright",
|
legend(LEGEND_POS, legend=legend_names,#"bottomright",
|
||||||
col=legend_colors,
|
col=legend_colors,
|
||||||
lty=legend_styles)
|
lty=legend_styles,
|
||||||
|
lwd=2)
|
||||||
|
|
||||||
par(las = 2, mar = c(10, 5, 1, 1))
|
par(las = 2, mar = c(10, 5, 1, 1))
|
||||||
dev.off()
|
dev.off()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user