set -e
-make -j -k
-
-./clueless-kmean
+function make_graph () {
+ CLUSTER1=($(grep ^0 clusters.dat))
+ CLUSTER2=($(grep ^1 clusters.dat))
+ CLUSTER3=($(grep ^2 clusters.dat))
-CLUSTER1=($(grep ^0 clusters.dat))
-CLUSTER2=($(grep ^1 clusters.dat))
-CLUSTER3=($(grep ^2 clusters.dat))
-
-gnuplot <<EOF
+ gnuplot <<EOF
set terminal pngcairo truecolor size 1024,768
-set output "result.png"
+set output "$1"
set size ratio 1
set key out vert
set key left top
"< grep ^2 clusters.dat" using 2:3 w p lc rgb "#ffffff" pt 2 lw 9 ps 4.0 notitle, \
"< grep ^2 clusters.dat" using 2:3 w p lc rgb "#0000c0" pt 2 lw 4 ps 4.0 title "Centroid 3"
EOF
+}
+
+make -j -k
+
+./clueless-kmean standard
+make_graph result-standard.png
+
+./clueless-kmean clueless
+make_graph result-clueless.png