-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_results.R
executable file
·48 lines (41 loc) · 1.62 KB
/
plot_results.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/xvfb-run Rscript
# script to make plots from data in `results.csv`.
#
# usage:
# $ scons
# $ bin/parseresults.py -o results.csv $(find output -type f -name santa.out) >results.csv
# $ plot_results.r
#
# Once the simulations have been run (scons) and the results have been aggregated (parseresults.py),
# tis routine can be called multiple times to remake or tweak the plots.
#
# Plot images in `bypopulation.png` and `byseqlen.png`
#
# note the funky shebang usage above. `xvfb-run` sets up a virtual
# X11 framebuffer. This allows us to run plotting packages in R like
# `ggplot` that would otherwise fail for lack of a working X11 server.
#
suppressWarnings(library(readr))
suppressMessages(library(dplyr))
suppressWarnings(library(ggplot2))
df <- read_csv('results.csv')
df <- df %>% filter(complete.cases(.)) %>% mutate(fpop=factor(population), flen=factor(length))
ggplot(df, aes(x=length, y=time, color=fpop, group=fpop)) +
theme_bw() +
labs(title='Run time as function of sequence length') +
xlab('Sequence length (nt)') +
ylab('Run time (sec)') +
geom_line(size=1) +
geom_point(size=1.1) +
labs(color = "Population size")
ggsave(filename='bypopulation.png', width=8, height=5, units='in')
ggplot(df, aes(x=population, y=time, color=flen, group=flen)) +
theme_bw() +
labs(title='Runtime as function of population size') +
xlab('Population size') +
ylab('Runtime (sec)') +
geom_line(size=1) +
geom_point(size=1.1) +
labs(color = "Sequence len")
ggsave(filename='byseqlen.png', width=8, height=5, units='in')
cat('Output plots have been left in bypopulation.png and byseqlen.png.\n')