Index: doc/theses/mike_brooks_MMath/plots/string-allocn.gp
===================================================================
--- doc/theses/mike_brooks_MMath/plots/string-allocn.gp	(revision 241042418538c37dbb8067200a54e09c370946d2)
+++ doc/theses/mike_brooks_MMath/plots/string-allocn.gp	(revision 5ba1356f6794e2949f1c46e02592c5668f7f27d9)
@@ -5,4 +5,5 @@
 INDIR="build"
 OUTDIR="build"
+SRCDIR="plots"
 
 SCALE=1024
@@ -11,13 +12,7 @@
 set macros
 set output OUTDIR."/plot-string-allocn.pdf"
-set multiplot layout 1, 3 ;
-set key outside top center horizontal
+set multiplot layout 1, 2 ;
 set grid
 
-# common to only first two graphs
-set logscale x 2
-#set mxtics 3                      # 3 steps within each doubling (e.g. 3 steps of of 32 between 32 and 128 => tick on 32s in there)
-set xlabel "Heap Used (B)"
-set logscale y 10
 
 #
@@ -25,9 +20,16 @@
 #
 
+#set errorbars dashtype '.'
+
+set logscale x 2
+set xlabel "Heap Used (B)"
+set logscale y 10
+set key outside top center
+
 set ylabel "Duration (ns)" offset 2,0
-set yrange[35:125]
-set ytics add (40, 50, 60, 70, 80, 90, 110, 120)
+set yrange[40:150]
+set ytics add (40, 50, 60, 70, 80, 90, 110, 120, 130, 140, 150)
 
-set xrange[32:4096]
+set xrange[32:8192]
 set xtics rotate by -90
 set xtics ("" 32, "64 k" 64, "" 128, "256 k" 256, "" 512, "1 M" 1024, "" 2048, "4 M" 4096)
@@ -35,16 +37,39 @@
 # First each curve, then each default-expansion point
 plot INDIR."/plot-string-allocn.dat" \
-	   i 0 using ($3/SCALE):2 title columnheader(1) with linespoints lt rgb "blue"    pt  2   ps 1 lw 1, \
-	'' i 1 using ($3/SCALE):2 title columnheader(1) with linespoints lt rgb "red"     pt  3   ps 1 lw 1, \
-	'' i 2 using ($3/SCALE):2 title columnheader(1) with linespoints lt rgb "brown"   pt  8   ps 1 lw 1, \
-	'' i 3 using ($3/SCALE):2 title columnheader(1) with linespoints lt rgb "black"   pt  10  ps 1 lw 1, \
-	'' i 4 using ($3/SCALE):2 title columnheader(1) with linespoints lt rgb "magenta" pt  12  ps 1 lw 1, \
-	'' i 0 using ( ($4 == 1) ? ($3/SCALE) : 1/0 ):2 notitle with points lt rgb "blue"    pt  66 ps 2, \
-	'' i 1 using ( ($4 == 1) ? ($3/SCALE) : 1/0 ):2 notitle with points lt rgb "red"     pt  66 ps 2, \
-	'' i 2 using ( ($4 == 1) ? ($3/SCALE) : 1/0 ):2 notitle with points lt rgb "brown"   pt  66 ps 2, \
-	'' i 3 using ( ($4 == 1) ? ($3/SCALE) : 1/0 ):2 notitle with points lt rgb "black"   pt  66 ps 2, \
-	'' i 4 using ( ($4 == 1) ? ($3/SCALE) : 1/0 ):2 notitle with points lt rgb "magenta" pt  66 ps 2
+	   i 0 using ($5/SCALE):2     notitle               with lines      lt rgb "blue"        dt '.'  lw 2, \
+	'' i 1 using ($5/SCALE):2     notitle               with lines      lt rgb "red"         dt '.'  lw 2, \
+	'' i 2 using ($5/SCALE):2     notitle               with lines      lt rgb "brown"       dt '.'  lw 2, \
+	'' i 3 using ($5/SCALE):2     title "tuning contour" with lines     lt rgb "black"       dt '.'  lw 2, \
+	'' i 4 using ($5/SCALE):2     notitle               with lines      lt rgb "magenta"     dt '.'  lw 2, \
+	'' i 0 using ($5/SCALE):2:3:4 notitle               with yerrorbars lt rgb "blue"    pt  7  ps 0.25 lw 1, \
+	'' i 1 using ($5/SCALE):2:3:4 notitle               with yerrorbars lt rgb "red"     pt  7  ps 0.25 lw 1, \
+	'' i 2 using ($5/SCALE):2:3:4 notitle               with yerrorbars lt rgb "brown"   pt  7  ps 0.25 lw 1, \
+	'' i 3 using ($5/SCALE):2:3:4 notitle               with yerrorbars lt rgb "black"   pt  7  ps 0.25 lw 1, \
+	'' i 4 using ($5/SCALE):2:3:4 notitle               with yerrorbars lt rgb "magenta" pt  7  ps 0.25 lw 1, \
+	'' i 0 using ( ($8 == 1) ? ($5/SCALE) : 1/0 ):2 notitle with points lt rgb "blue"    pt  66 ps 2, \
+	'' i 1 using ( ($8 == 1) ? ($5/SCALE) : 1/0 ):2 notitle with points lt rgb "red"     pt  66 ps 2, \
+	'' i 2 using ( ($8 == 1) ? ($5/SCALE) : 1/0 ):2 notitle with points lt rgb "brown"   pt  66 ps 2, \
+	'' i 3 using ( ($8 == 1) ? ($5/SCALE) : 1/0 ):2 title "default tuning" \
+	                                                        with points lt rgb "black"   pt  66 ps 2, \
+	'' i 4 using ( ($8 == 1) ? ($5/SCALE) : 1/0 ):2 notitle with points lt rgb "magenta" pt  66 ps 2, \
+	'' i 0 using ($5/SCALE):2:("{/Times=15 len-\n20")  every ::1::1 with labels left  offset  0.75,0.25 textcolor rgb "blue"    notitle, \
+	'' i 1 using ($5/SCALE):2:("{/Times=15 len-\n50")  every ::5::5 with labels right offset -0.6 ,1.5  textcolor rgb "red"     notitle, \
+	'' i 2 using ($5/SCALE):2:("{/Times=15 len-\n100") every ::4::4 with labels right offset -0.75,0.5  textcolor rgb "brown"   notitle, \
+	'' i 3 using ($5/SCALE):2:("{/Times=15 len-\n200") every ::4::4 with labels right offset -0.75,1.25 textcolor rgb "black"   notitle, \
+	'' i 4 using ($5/SCALE):2:("{/Times=15 len-\n500") every ::4::4 with labels right offset -0.75,0.25 textcolor rgb "magenta" notitle, \
+	'' i 5 using                          ($5/SCALE)        :2     notitle               with lines       lt rgb "#BF007F7F"               lw 8, \
+	'' i 6 using                          ($5/SCALE)        :2     notitle               with lines       lt rgb "#BF007F7F"               lw 8, \
+	'' i 7 using                          ($5/SCALE)        :2     notitle               with lines       lt rgb "#BF007F7F"               lw 8, \
+	'' i 8 using                          ($5/SCALE)        :2     title "tradeoff"      with lines       lt rgb "#BF007F7F"              lw 8, \
+	'' i 9 using                          ($5/SCALE)        :2     notitle               with lines       lt rgb "#BF007F7F"               lw 8, \
+	'' i 5 using ( (strcol(8) eq "stl") ? ($5/SCALE) : 1/0 ):2:3:4 notitle               with yerrorbars  lt rgb "#00007F7F"  pt 6     ps 0.5 lw 2 ,       \
+	'' i 6 using ( (strcol(8) eq "stl") ? ($5/SCALE) : 1/0 ):2:3:4 notitle               with yerrorbars  lt rgb "#00007F7F"  pt 6     ps 0.5 lw 2 ,       \
+	'' i 7 using ( (strcol(8) eq "stl") ? ($5/SCALE) : 1/0 ):2:3:4 notitle               with yerrorbars  lt rgb "#00007F7F"  pt 6     ps 0.5 lw 2 ,       \
+	'' i 8 using ( (strcol(8) eq "stl") ? ($5/SCALE) : 1/0 ):2:3:4 notitle               with yerrorbars  lt rgb "#00007F7F"  pt 6     ps 0.5 lw 2 , \
+	'' i 9 using ( (strcol(8) eq "stl") ? ($5/SCALE) : 1/0 ):2:3:4 notitle               with yerrorbars  lt rgb "#00007F7F"  pt 6     ps 0.5 lw 2
+
 
 unset ylabel
+unset xlabel
 
 unset xtics
@@ -53,41 +78,4 @@
 unset xrange
 
-
-#
-# STL comparison
-#
-
-
-set yrange[40:85]
-set ytics add (40, 45, 50, 55, 60, 65, 70, 75, 80, 85)
-set mytics 90                     # 90 steps within each decade (e.g. 90 steps of of 1 between 10 and 100 => tick on 1s in there)
-
-set xrange[64:4096]
-set xtics rotate by -90
-set xtics ("64 k" 64, "128 k" 128, "256 k" 256, "512 k" 512, "1 M" 1024, "2 M" 2048, "4 M" 4096)
-
-# skullduggeries:
-# hardcoding chunk index and assuming data in the chunk (by hardcoding only the stl series title)
-# series order is meaningless but important: achieves z-order readability and legend order acceptability
-
-plot INDIR."/plot-string-allocn.dat" \
-	   i 8 using                          ($3/SCALE)        :2 title "tradeoff"      with lines       lt rgb "#77000000"  dt (2,2)       lw 8, \
-	'' i 1 using                          ($3/SCALE)        :2 title columnheader(1) with linespoints lt rgb "red"        pt  3    ps 1  lw 1, \
-	'' i 6 using ( (strcol(4) eq "cfa") ? ($3/SCALE) : 1/0 ):2 notitle               with points      lt rgb "red"        pt 66    ps 2,       \
-	'' i 6 using                          ($3/SCALE)        :2 notitle               with lines       lt rgb "#77000000"  dt (2,2)       lw 8, \
-	'' i 6 using ( (strcol(4) eq "stl") ? ($3/SCALE) : 1/0 ):2 title "stl, len=50"   with points      lt rgb "red"        pt 5     ps 1,       \
-	'' i 3 using                          ($3/SCALE)        :2 title columnheader(1) with linespoints lt rgb "black"      pt  10   ps 1  lw 1, \
-	'' i 8 using ( (strcol(4) eq "stl") ? ($3/SCALE) : 1/0 ):2 title "stl, len=200"  with points      lt rgb "black"      pt 5     ps 1,       \
-	'' i 8 using ( (strcol(4) eq "cfa") ? ($3/SCALE) : 1/0 ):2 notitle               with points      lt rgb "black"      pt 66    ps 2
-
-
-unset mytics
-unset ytics
-unset yrange
-unset xrange
-
-
-
-# common to first two graphs
 unset logscale
 unset xlabel
@@ -98,11 +86,56 @@
 #
 
-set style data histogram
+set key outside top center vertical maxrows 3
+
+set logscale x 2
+#set mxtics 3                      # 3 steps within each doubling (e.g. 3 steps of of 32 between 32 and 128 => tick on 32s in there)
+
+set yrange[0:105]
 set ytics auto
-set style histogram clustered gap 1 rowstacked
-set style fill solid border -1
-set boxwidth 0.8
-set xtics rotate by -45
 
-plot for [col=3:8] \
-    INDIR.'/plot-string-allocn-attrib.dat' using col:xticlabels(stringcolumn(2).", len=".stringcolumn(1)) index 0 title columnheader(col)
+set xrange[2.0e4:3e7]
+# set xtics rotate by -90
+# set xtics ("" 32, "64 k" 64, "" 128, "256 k" 256, "" 512, "1 M" 1024, "" 2048, "4 M" 4096)
+
+set style fill solid 1.0
+
+BAR_RELWD = 0.5
+BAR_XSHIFT = (1+BAR_RELWD)**(-0.55)
+LEN_X_SEP = 1.7
+
+# get segment draw order (front to back) from metadata file
+meta = system('cat '.SRCDIR.'/string-allocn-attrib-meta.dat')
+STATS_words = words(meta)
+array STATS_word[STATS_words]
+do for [i=1:STATS_words] {
+    STATS_word[i] = word(meta, i)
+}
+
+
+
+plot \
+	for [i=STATS_words:1:-1] \
+	INDIR.'/plot-string-allocn-attrib.dat' \
+		using (stringcolumn("category") eq STATS_word[i] ? (BAR_XSHIFT*$1**LEN_X_SEP*$3/SCALE) : 1/0): \
+			  (stringcolumn("category") eq STATS_word[i] ? ($5 + $8) : 1/0): \
+			  (stringcolumn("category") eq STATS_word[i] ? (BAR_RELWD*(BAR_XSHIFT*$1**LEN_X_SEP*$3/SCALE)) : 1/0) \
+		with boxes ls i title STATS_word[i], \
+	INDIR."/plot-string-allocn.dat" \
+	   i 1 using (50 **LEN_X_SEP*$5/SCALE):2     notitle with lines      lt rgb "red"         dt '.'  lw 2, \
+	'' i 3 using (200**LEN_X_SEP*$5/SCALE):2     notitle with lines      lt rgb "black"       dt '.'  lw 2, \
+	'' i 1 using ( ($8 == 1) ? (50 **LEN_X_SEP*$5/SCALE) : 1/0 ):2 notitle with points lt rgb "red"     pt  66 ps 2, \
+	'' i 3 using ( ($8 == 1) ? (200**LEN_X_SEP*$5/SCALE) : 1/0 ):2 notitle with points lt rgb "black"   pt  66 ps 2, \
+	'' i 1 using ( ($8 == 1) ? (50 **LEN_X_SEP*$5/SCALE) : 1/0 ):2:3:4 notitle with yerrorbars lt rgb "red"     pt  7  ps 0.25 lw 1, \
+	'' i 3 using ( ($8 == 1) ? (200**LEN_X_SEP*$5/SCALE) : 1/0 ):2:3:4 notitle with yerrorbars lt rgb "black"   pt  7  ps 0.25 lw 1, \
+	'' i 1 using (50 **LEN_X_SEP*$5/SCALE):2:("{/Times=15 len-\n50")  every ::5::5 with labels right offset -0.6 ,1.5  textcolor rgb "red"     notitle, \
+	'' i 3 using (200**LEN_X_SEP*$5/SCALE):2:("{/Times=15 len-\n200") every ::4::4 with labels right offset -0.75,1.25 textcolor rgb "black"   notitle, \
+	'' i 6 using                          (50 **LEN_X_SEP*$5/SCALE)        :2     notitle      with lines   lt rgb "#BF007F7F"               lw 8, \
+	'' i 8 using                          (200**LEN_X_SEP*$5/SCALE)        :2     notitle      with lines   lt rgb "#BF007F7F"              lw 8, \
+	'' i 6 using ( (strcol(8) eq "stl") ? (50 **LEN_X_SEP*$5/SCALE) : 1/0 ):2:3:4     notitle      with yerrorbars  lt rgb "#00007F7F"  pt 6     ps 0.5 lw 2 ,       \
+	'' i 8 using ( (strcol(8) eq "stl") ? (200**LEN_X_SEP*$5/SCALE) : 1/0 ):2:3:4     notitle      with yerrorbars  lt rgb "#00007F7F"  pt 6     ps 0.5 lw 2
+
+
+#	   i 6 using                          ($5/SCALE)        :2:(BAR_RELWD*($5/SCALE))     notitle               with boxes  lt rgb "grey"    , \
+#	'' i 8 using                          ($5/SCALE)        :2:(BAR_RELWD*($5/SCALE))     notitle               with boxes  lt rgb "grey"    , \
+#	'' i 6 using                          ($5/SCALE)        :($2-40):(BAR_RELWD*($5/SCALE))     notitle               with boxes  lt rgb "blue", \
+#	'' i 8 using                          ($5/SCALE)        :($2-40):(BAR_RELWD*($5/SCALE))     notitle               with boxes  lt rgb "blue", \
