Plot impr
This commit is contained in:
parent
ebe8b7e028
commit
f146de0e30
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/env Rscript
|
#!/usr/bin/env Rscript
|
||||||
|
|
||||||
|
# Parse job from command line
|
||||||
|
args = commandArgs(trailingOnly = TRUE)
|
||||||
|
file = args[1]
|
||||||
|
|
||||||
library(ggplot2)
|
library(ggplot2)
|
||||||
library(dplyr)
|
library(dplyr)
|
||||||
require(scales)
|
require(scales)
|
||||||
|
@ -12,10 +16,10 @@ plotjobs = TRUE
|
||||||
# Color scheme
|
# Color scheme
|
||||||
plotcolors <- c("#CC0000", "#FFA500", "#FFFF00", "#008000", "#9999ff", "#000099")
|
plotcolors <- c("#CC0000", "#FFA500", "#FFFF00", "#008000", "#9999ff", "#000099")
|
||||||
|
|
||||||
# Parse job from command line
|
if (! exists("file")){
|
||||||
args = commandArgs(trailingOnly = TRUE)
|
|
||||||
file = "job_similarities_5024292.csv" # for manual execution
|
file = "job_similarities_5024292.csv" # for manual execution
|
||||||
file = args[1]
|
}
|
||||||
|
print(file)
|
||||||
jobID = str_extract(file, regex("[0-9]+"))
|
jobID = str_extract(file, regex("[0-9]+"))
|
||||||
|
|
||||||
data = read.csv(file)
|
data = read.csv(file)
|
||||||
|
@ -28,12 +32,12 @@ cat(nrow(data))
|
||||||
|
|
||||||
# empirical cumulative density function (ECDF)
|
# empirical cumulative density function (ECDF)
|
||||||
data$sim = data$similarity*100
|
data$sim = data$similarity*100
|
||||||
ggplot(data, aes(sim, color=alg_name, group=alg_name)) + stat_ecdf(geom = "step") + xlab("Similarity in %") + ylab("Fraction of jobs") + theme(legend.position=c(0.05, 0.5), legend.title = element_blank()) + scale_color_brewer(palette = "Set2") + scale_x_log10()
|
ggplot(data, aes(sim, color=alg_name, group=alg_name)) + stat_ecdf(geom = "step") + xlab("Similarity in %") + ylab("Fraction of jobs") + theme(legend.position=c(0.9, 0.5), legend.title = element_blank()) + scale_color_brewer(palette = "Set2") # + scale_x_log10() +
|
||||||
ggsave("ecdf.png", width=8, height=2.5)
|
ggsave("ecdf.png", width=8, height=2.5)
|
||||||
|
|
||||||
# histogram for the jobs
|
# histogram for the jobs
|
||||||
ggplot(data, aes(sim), group=alg_name) + geom_histogram(color="black", binwidth=2.5) + aes(fill = alg_name) + facet_grid(alg_name ~ ., switch = 'y') + xlab("Similarity in %") + scale_y_continuous(limits=c(0, 100), oob=squish) + scale_color_brewer(palette = "Set2") + ylab("Count (cropped at 100)") + theme(legend.position = "none") + stat_bin(binwidth=2.5, geom="text", adj=1.0, angle = 90, colour="black", size=3, aes(label=..count.., y=0*(..count..)+95))
|
ggplot(data, aes(sim), group=alg_name) + geom_histogram(color="black", binwidth=2.5) + aes(fill = alg_name) + facet_grid(alg_name ~ ., switch = 'y') + xlab("Similarity in %") + scale_y_continuous(limits=c(0, 100), oob=squish) + scale_color_brewer(palette = "Set2") + ylab("Count (cropped at 100)") + theme(legend.position = "none") + stat_bin(binwidth=2.5, geom="text", adj=1.0, angle = 90, colour="black", size=3, aes(label=..count.., y=0*(..count..)+95))
|
||||||
ggsave("hist-sim.png", width=6, height=4.5)
|
ggsave("hist-sim.png", width=6, height=5)
|
||||||
|
|
||||||
#ggplot(data, aes(similarity, color=alg_name, group=alg_name)) + stat_ecdf(geom = "step") + xlab("SIM") + ylab("Fraction of jobs") + theme(legend.position=c(0.9, 0.4)) + scale_color_brewer(palette = "Set2") + xlim(0.5, 1.0)
|
#ggplot(data, aes(similarity, color=alg_name, group=alg_name)) + stat_ecdf(geom = "step") + xlab("SIM") + ylab("Fraction of jobs") + theme(legend.position=c(0.9, 0.4)) + scale_color_brewer(palette = "Set2") + xlim(0.5, 1.0)
|
||||||
#ggsave("ecdf-0.5.png", width=8, height=3)
|
#ggsave("ecdf-0.5.png", width=8, height=3)
|
||||||
|
@ -56,7 +60,6 @@ plotJobs = function(algorithm, jobs){
|
||||||
script = "./scripts/plot-job-timelines-ks.py"
|
script = "./scripts/plot-job-timelines-ks.py"
|
||||||
}else{
|
}else{
|
||||||
script = "./scripts/plot-job-timelines.py"
|
script = "./scripts/plot-job-timelines.py"
|
||||||
return(0) ### FIXME
|
|
||||||
}
|
}
|
||||||
prefix = do.call("sprintf", list("%s-%.4f-", level, r$similarity))
|
prefix = do.call("sprintf", list("%s-%.4f-", level, r$similarity))
|
||||||
call = sprintf("%s %s %s", script, paste(r$jobid, collapse=","), paste(prefix, collapse=","))
|
call = sprintf("%s %s %s", script, paste(r$jobid, collapse=","), paste(prefix, collapse=","))
|
||||||
|
|
Loading…
Reference in New Issue