Better plotting.
This commit is contained in:
parent
70739e74d5
commit
58709e01e6
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# call me from parent directory
|
# call me from the parent directory
|
||||||
|
|
||||||
for I in job_similarities_*.csv ; do
|
for I in job_similarities_*.csv ; do
|
||||||
./scripts/plot.R $I > description.txt
|
./scripts/plot.R $I > description.txt
|
||||||
mkdir $I.out
|
OUT=${I%%.csv}-out
|
||||||
rm $I.out/*
|
mkdir $OUT
|
||||||
mv *.png *.pdf description.txt $I.out
|
rm $OUT/*
|
||||||
|
mv *.png *.pdf description.txt $OUT
|
||||||
done
|
done
|
||||||
|
|
|
@ -10,6 +10,8 @@ import matplotlib.cm as cm
|
||||||
jobs = sys.argv[1].split(",")
|
jobs = sys.argv[1].split(",")
|
||||||
prefix = sys.argv[2].split(",")
|
prefix = sys.argv[2].split(",")
|
||||||
|
|
||||||
|
fileformat = ".png"
|
||||||
|
|
||||||
print("Plotting the job: " + str(jobs))
|
print("Plotting the job: " + str(jobs))
|
||||||
|
|
||||||
# Color map
|
# Color map
|
||||||
|
@ -81,7 +83,7 @@ def plot(prefix, header, row):
|
||||||
|
|
||||||
fsize = (8, 1 + 1.5 * len(labels))
|
fsize = (8, 1 + 1.5 * len(labels))
|
||||||
fsizeFixed = (8, 2)
|
fsizeFixed = (8, 2)
|
||||||
|
|
||||||
pyplot.close('all')
|
pyplot.close('all')
|
||||||
|
|
||||||
if len(labels) < 4 :
|
if len(labels) < 4 :
|
||||||
|
@ -93,7 +95,7 @@ def plot(prefix, header, row):
|
||||||
ax[i].set_ylabel(l)
|
ax[i].set_ylabel(l)
|
||||||
|
|
||||||
pyplot.xlabel("Segment number")
|
pyplot.xlabel("Segment number")
|
||||||
pyplot.savefig(prefix + "timeseries" + jobid + ".pdf", bbox_inches='tight')
|
pyplot.savefig(prefix + "timeseries" + jobid + fileformat, bbox_inches='tight')
|
||||||
|
|
||||||
# Plot first 30 segments
|
# Plot first 30 segments
|
||||||
if len(timeseries) <= 50:
|
if len(timeseries) <= 50:
|
||||||
|
@ -109,7 +111,7 @@ def plot(prefix, header, row):
|
||||||
ax[i].set_ylabel(l)
|
ax[i].set_ylabel(l)
|
||||||
|
|
||||||
pyplot.xlabel("Segment number")
|
pyplot.xlabel("Segment number")
|
||||||
pyplot.savefig(prefix + "timeseries" + jobid + "-30.pdf", bbox_inches='tight')
|
pyplot.savefig(prefix + "timeseries" + jobid + "-30" + fileformat, bbox_inches='tight')
|
||||||
|
|
||||||
### end plotting function
|
### end plotting function
|
||||||
|
|
||||||
|
|
|
@ -23,16 +23,17 @@ cat("Job count:")
|
||||||
cat(nrow(data))
|
cat(nrow(data))
|
||||||
|
|
||||||
# empirical cummulative density function (ECDF)
|
# empirical cummulative density function (ECDF)
|
||||||
ggplot(data, aes(similarity, color=alg_name, group=alg_name)) + stat_ecdf(geom = "step") + xlab("SIM") + ylab("Fraction of jobs") + theme(legend.position="bottom") + scale_color_brewer(palette = "Set2")
|
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")
|
||||||
ggsave("ecdf.png")
|
ggsave("ecdf.png", width=8, height=3)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
e = data %>% filter(similarity >= 0.5)
|
e = data %>% filter(similarity >= 0.5)
|
||||||
ggplot(e, aes(similarity, color=alg_name, group=alg_name)) + stat_ecdf(geom = "step") + xlab("SIM") + ylab("Fraction of jobs") + theme(legend.position="bottom") + scale_color_brewer(palette = "Set2")
|
|
||||||
print(summary(e))
|
print(summary(e))
|
||||||
ggsave("ecdf-0.5.png")
|
|
||||||
|
|
||||||
# histogram for the jobs
|
# histogram for the jobs
|
||||||
ggplot(data, aes(similarity), group=alg_name) + geom_histogram(color="black", binwidth=0.025) + aes(fill = alg_name) + facet_grid(alg_name ~ ., switch = 'y') + scale_y_continuous(limits=c(0, 100), oob=squish) + scale_color_brewer(palette = "Set2") + ylab("Count (cropped at 100)") + theme(legend.position = "none")
|
ggplot(data, aes(similarity), group=alg_name) + geom_histogram(color="black", binwidth=0.025) + aes(fill = alg_name) + facet_grid(alg_name ~ ., switch = 'y') + 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=0.025, geom="text", angle = 90, colour="black", size=3, aes(label=..count.., y=0*(..count..)+20))
|
||||||
ggsave("hist-sim.png")
|
ggsave("hist-sim.png")
|
||||||
|
|
||||||
# load job information, i.e., the time series per job
|
# load job information, i.e., the time series per job
|
||||||
|
@ -51,8 +52,8 @@ plotJobs = function(jobs){
|
||||||
|
|
||||||
# print the job timelines
|
# print the job timelines
|
||||||
r = e[ordered, ]
|
r = e[ordered, ]
|
||||||
prefix = do.call("sprintf", list("%s-%.0f-", level, r$similarity))
|
#prefix = do.call("sprintf", list("%s-%.0f-", level, r$similarity))
|
||||||
system(sprintf("scripts/plot-single-job.py %s %s", paste(r$jobid, collapse=","), paste(prefix, collapse=",")))
|
#system(sprintf("scripts/plot-single-job.py %s %s", paste(r$jobid, collapse=","), paste(prefix, collapse=",")))
|
||||||
}
|
}
|
||||||
|
|
||||||
# Store the job ids in a table, each column is one algorithm
|
# Store the job ids in a table, each column is one algorithm
|
||||||
|
@ -94,7 +95,7 @@ print(res.intersect)
|
||||||
|
|
||||||
# Plot heatmap about intersection
|
# Plot heatmap about intersection
|
||||||
ggplot(tbl.intersect, aes(first, second, fill=intersect)) + geom_tile() + geom_text(aes(label = round(intersect, 1))) + scale_fill_gradientn(colours = rev(plotcolors))
|
ggplot(tbl.intersect, aes(first, second, fill=intersect)) + geom_tile() + geom_text(aes(label = round(intersect, 1))) + scale_fill_gradientn(colours = rev(plotcolors))
|
||||||
ggsave("intersection-heatmap.png")
|
ggsave("intersection-heatmap.png", width=6, height=5)
|
||||||
|
|
||||||
# Collect the metadata of all jobs in a new table
|
# Collect the metadata of all jobs in a new table
|
||||||
res.jobs = tibble()
|
res.jobs = tibble()
|
||||||
|
|
Loading…
Reference in New Issue