#!/usr/bin/gri // get the number of command line arguments .n. = {rpn argc} // reduce it by 1 .n. -= 1 // extract the file name of the data given \f = {rpn .n. argv} // get the 3rd line in the data file (this is the first reference structure \t1 = system awk 'NR==3 {print $1}' \f // get the 4th line in the data file (this is the second reference structure) \t2 = system awk 'NR==4 {print $1}' \f // extract the actual data columns (1,2,7) to a temporary file system awk 'NR>6 {print $1, $2, $7}' \f > \f.TMP // open the temporary file open \f.TMP // read the data read columns x y z // close the temporary file close // remove the temporary file unlink \f.TMP // set the output file name of the postscript image set postscript filename \f.ps // set the font size of the x coordinate label set x size 14 //set the font size of the y coordinate label set y size 14 // set the x label set x name "\t1" //set the y label set y name "\t2" // get the maximum value in x direction .xmax. = {rpn x max} // set the range of the x axis set x axis 0 .xmax. 5 // get the maximum value in y direction .ymax. = {rpn y max} //set the range of the y axis set y axis 0 .ymax. 5 // draw both axes draw axes // set line width set line width symbol 2 // set symbol size set symbol size 2 // draw symbol bullet set font size 12 // create a grid for the data values set x grid 0 .xmax. 1 set y grid 0 .ymax. 1 // convert actual read data to the grid points // Use default method (Barnes) convert columns to grid objective # 2 2 4 1 // get minimal z value .tmp. = {rpn z min} .zmin. = {rpn .tmp. ceil} // set z range for the color image set image range .zmin. 0 // set color gradient for the image set image colorscale hsb .666 1 1 .zmin. hsb 0 1 1 0 // create the image using the gridded data convert grid to image #set image colorscale \scale // draw the image draw image // set line width and style set line width rapidograph 2 // prepare some variables for contour plot // lower zmin value to the next number divisile by 4 .zmin. -= {rpn .zmin. 4 remainder} // set zmin2 .zmin2. = .zmin. .zmin2. += 2 // draw contour lines in range [.zmin.:0] with step size 4 draw contour .zmin. 0 4 // set line width and style set line width rapidograph 3x0 // draw contour lines in range [.zmin. + 2:0] with step size 2 draw contour .zmin2. 0 2 // set line width and style set line width rapidograph 6x0 // set dashed line style set dash 0.1 0.1 // dra contour lines without label in range [.zmin. + 2:0] with step size 1 draw contour .zmin2. 0 1 unlabelled // quit gri quit