# Given a user-provided data file of values of a function z on a mesh # in the x,y-plane, this script shows the different levels of z values # in the x,y-plane as colors. # The name of the data file should be as specified on the splot # command below. # Assuming that the x and y positions are equally spaced, the data # file can just have the mesh z-values, one per line, with the # x-coordinate varying fastest, and a blank line between lines of # different y. In that case, the plotted x and y-values are integer, # and full xtics and ytics will need to be specified. # Otherwise you need to specify all three of x, y, and z in the data # file, one set of three numbers on each line. You should have y # going fastest, and blank lines in between lines of different x. # In Fortran terms, if i is the index in the x-direction, j the one in # the y-direction, and z(i,j) are the function values for which to # plot color levels, the data file could be created as: # 10 format(3g15.5) # do 30 i=1,imax # do 20 j=1,jmax # write(1,10)x(i),y(j),z(i,j) # 20 continue # write(1,10) # 30 continue # Substitute your favorite equivalent C, C++, or m code as desired. # Numbers should normally be separated by blank space, not commas. If # you have an existing data file that uses commas, like an excel file, # set the data file separator below. # If you want to add curves to the plot, it gets a bit tricky. Make # sure the file of curves has a dummy z-value for each x,y pair, # preferably not all exactly equal. Separate curves by blank lines. # Add a dummy curve of just one triplet x,y,z to prevent gnuplot from # cross-connecting the curves. # Normally, you can run this script from a terminal as # gnuplot color.txt # In case of problems, check the error messages by using # gnuplot # load "color.txt" # File cmmi10.pfa should be in the current folder. # Start of the script commands. # Lines starting with '# ' are comments that are ignored. Lines # starting with '#' not followed by a space are disabled commands. # You can enable such a command by removing the # # set terminal to postscript (plot size is 5 by 3 inches) set terminal postscript eps size 5, 3 enhanced color \ fontfile "cmmi10.pfa" "Times-Roman" 20 # output file name of the plot set output 'color.eps' # size of the major and minor tick marks set tics scale 0.5, 0.25 # x plot range as [BEGIN:END] (use [:] to plot all x) set xrange [:] # x-axis label (see ps_guide.pdf for details) set xlabel '{/CMMI10 x}' offset 0, 0 # user-specified labels and corresponding tick positions #set xtics ("0" 0, "1" 1, "2" 2) # do not copy the ticks to the top boundary of the graph set xtics nomirror # y plot range as [BEGIN:END] (use [:] to plot all y) set yrange [:] # y-axis label (see ps_guide.pdf for details) set ylabel '{/CMMI10 y}' offset 0, 0 # user-specified labels and corresponding tick positions #set ytics ("0" 0, "0.5" .5, "1.0" 1) # do not copy the ticks to the right boundary of the graph set ytics nomirror # z plot range as [BEGIN:END] (use [:] to plot all z) set zrange [:] # z-axis label (see ps_guide.pdf and ps_fontfile_doc.pdf for details) set zlabel '{/CMMI10 \041}' offset 0, 0 # user-specified labels and corresponding tick positions #set ztics ("0" 0, "0.5" 0.5, "1" 1) # do not copy the ticks to the right boundary of the graph set ztics nomirror # range of z-values [BEGIN:END] having varying colors (use [:] for all z) set cbrange [:] # specify where the color box is put (0 < x,y < 1) (unset colorbox for no box) set colorbox vertical user origin .87, .3 size .03, .4 # do not copy the color box ticks to its left boundary set cbtics nomirror # put labels inside the graph (see ps_guide.pdf for details) set label '{/Times-Roman White Miata Goertler Vortices}' at screen 0.33, 0.9 set label '{/CMMI10 \041}' at screen 0.97, 0.5 # set for drawing greyscale/color surfaces/maps with splot set pm3d at b scansforward # set for color printable in grey scale: black-blue-violet-yellow-white set palette color rgbformulae 30,31,32 negative # black blue red yellow #set palette color rgbformulae 7,5,15 positive # green red violet #set palette color rgbformulae 3,11,6 positive # green blue white #set palette color rgbformulae 23,28,3 positive # black red yellow white #set palette color rgbformulae 21,22,23 positive # rainbow blue green yellow red #set palette color rgbformulae 33,13,10 positive # black red yellow white #set palette color rgbformulae 34,35,36 positive # set simply for grey scale #set palette gray gamma 1.5 positive # set for planar contour plots or color maps set view map # do not draw a surface f(x,y), just contour lines unset surface # more than one plot set multiplot # plot the data file splot "goertler.plt" notitle # add curves as surface trajectories (correct the x and y ranges) #unset pm3d #set surface #set xrange [0:1] #set yrange [0:1] #splot "color2.plt" notitle with lines lt -1 lw 1 # finish up unset multiplot # end