# Given a user-provided data file of one or more curves y(x), y2(x), # ..., each given as a set of x-values and corresponding y-values, # this script draws the curves in the x,y-plane. # The name of the data file should be as specified on the plot # command below. # It should have the x and corresponding y-values as a single pair on # each line, in order of increasing x. If there is more than one # curve to draw, leave a blank line between different curves. # In Fortran terms, if the x(i) are the x values and y(i) and y2(i) the # corresponding y-values of two curves y and y2, the data file could be # created as: # 10 format(2g15.5) # do 20 i=1,imax # write(1,10)x(i),y(i) # 20 continue # write(1,10) # do 30 i=1,imax # write(1,10)x(i),y2(i) # 30 continue # Substitute your favorite equivalent C, C++, or m code as desired. # The write statement without arguments writes the blank line. # 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. # Normally, you can run this script from a terminal as # gnuplot curves.txt # In case of problems, check the error messages by using # gnuplot # load "curves.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 \ fontfile "cmmi10.pfa" "Times-Roman" 20 # output file name of the plot set output 'curves.eps' # set the borders to plot, the sum of: # 1 for bottom, 2 for left, 4 for top and 8 for right. # so 1+2=3 is normal, but use 1+2+8=11 if you have a second y-axis, set border 11 # 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 t}' 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 [0:100] # y-axis label (see ps_guide.pdf for details) # (and the \075 for the math slash comes from ps_fontfile_doc.pdf) set ylabel '{/CMMI10 v_{/Times-Roman=15 p}\075v_{/Times-Roman=15 p,white Miata, max}}' offset 0, 0 # user-specified labels and corresponding tick positions set ytics ("0%%" 0, "20%%" 20, "40%%" 40, "60%%" 60, "80%%" 80, "100%%" 100) # do not copy the ticks to the right boundary of the graph set ytics nomirror # right-hand axis plot range as [BEGIN:END] (use [:] to plot all y2) set y2range [0:1] # right hand axis label (see ps_guide.pdf for details) set y2label \ '{/CMMI10 a{/Times-Roman (}t{/Times-Roman )}\075a{/Times-Roman (0)}}' \ offset 0, 0 # user-specified labels and corresponding tick positions set y2tics ("0.0" 0, "0.2" .2, "0.4" .4, "0.6" .6, "0.8" .8, "1.0" 1) # turn on tick marks on the right-hand y-axis set y2tics # logarithmic axes, if any # (you can specify the x, y, z, or cb axe in any order or x2 or y2) # (see the gnuplot.pdf manual for details.) #set logscale # leave off the labels from the tics #set format "" # put labels inside the graph # (see ps_guide.pdf for details) # (for mathematical symbols, consult ps_fontfile_doc.pdf) set label '{/CMMI10 v_{/Times-Roman=15 white Miata}}' at screen 0.5, 0.76 set label '{/CMMI10 v_{/Times-Roman=15 red Miata}}' at screen 0.5, 0.44 set label '{/CMMI10 a}' at screen 0.5, 0.28 # if the data are separated by commas, uncomment the line below (remove #) #set datafile separator "," # plot curves of type lt and thickness lw (in pt), and points # of type pt and size ps (see ps_symbols.pdf for details): plot "veloc.plt" axes x1y1 notitle with lines lt 1 lw 1 \ , "meas.plt" axes x1y1 notitle with points pt 6 ps 1 \ , "accel.plt" axes x1y2 notitle with lines lt 4 lw 1 \ # end