#
# Two ways of generating a 2D heat map from ascii data
#
if ((GPVAL_VERSION == 4.1 || GPVAL_VERSION == 4.2) \
&&  (!strstrt(GPVAL_COMPILE_OPTIONS,"+IMAGE"))) \
    print ">>> Skipping demo <<<\n" ; \
    print "This copy of gnuplot was built without support for plotting images" ; \
    exit ;

set title "Heat Map generated from a file containing Z values only"
unset key
set tic scale 0

# Color runs from white to green
set palette rgbformula -7,2,-7
set cbrange [0:5]
set cblabel "Score"
unset cbtics

set xrange [-0.5:4.5]
set yrange [-0.5:4.5]

set view map
splot '-' matrix with image
5 4 3 1 0
2 2 0 0 1
0 0 0 1 0
0 0 0 2 3
0 1 2 4 3
e
e

pause -1 "Hit return to continue"

set title "Heat Map generated by 'plot' from a stream of XYZ values"\
         ."\nNB: Rows must be separated by blank lines!"

plot '-' using 2:1:3 with image
0 0 5
0 1 4
0 2 3
0 3 1
0 4 0

1 0 2
1 1 2
1 2 0
1 3 0
1 4 1

2 0 0
2 1 0
2 2 0
2 3 1
2 4 0

3 0 0
3 1 0
3 2 0
3 3 2
3 4 3

4 0 0
4 1 1
4 2 2
4 3 4
4 4 3
e

pause -1 "Hit return to continue"

reset
