# $Id: graphs.txt,v 1.5 2004/02/10 03:46:22 tjn Exp $ + To set the xdata to a time format of "seconds since the epoch" gnuplot> set xdata time gnuplot> set timefmt "%s" #(format of epoch secs) --------------------------------- + GNUplot Starter Reference with lots of info! * "GNUPLOT - not so Frequently Asked Questions" http://art.aees.kyushu-u.ac.jp/members/kawano/gnuplot/index-e.html UPDATE (2/9/04), new URL http://t16web.lanl.gov/Kawano/gnuplot/index-e.html * "An example of use of gnuplot for technical paper submission" http://art.aees.kyushu-u.ac.jp/members/kawano/gnuplot/esub/index-e.html The following is primarily from this general "Introduction to gnuplot" http://art.aees.kyushu-u.ac.jp/members/kawano/gnuplot/intro/index-e.html UPDATE (2/9/04), new URL http://t16web.lanl.gov/Kawano/gnuplot/index-e.html Using the 'data1' and 'data2' files as used with the Bar Graphs below. # Startup GNUplot tjn: $ gnuplot # This reads in the data files and uses the selected columns # for data input (cols 1 & 2). The style is set to linespoints "lp" # other options might be 'lines', 'points', etc. gnuplot> plot "data1" using 1:2 with lp, "data2" using 1:2 with lp # Insert some labels and redraw gnuplot> set xlabel "x num procs gnuplot> set xlabel "x - num procs" gnuplot> set ylabel "y - speedup" gnuplot> set title "Cluster Speedups" gnuplot> replot # Limit the range (not really a good idea for this plot :) ) gnuplot> set xrange [0:6] gnuplot> set yrange [0:1] gnuplot> replot # So move out, rather than in :) gnuplot> set xrange [0:10] gnuplot> set yrange [0:1] gnuplot> replot # Now add labels to the line color keys gnuplot> plot "data1" using 1:2 title "XTORC" with lines,\ > "data2" using 1:2 title "TORC" with lines # Set graduations (not necessarily best for this data set) gnuplot> set xtics 1 gnuplot> set mxtics 5 gnuplot> set ytics 0.5 gnuplot> set mytics 5 gnuplot> replot # Output results to a Postscript file! gnuplot> set term postscript Terminal type set to 'postscript' Options are 'landscape noenhanced monochrome dashed defaultplex "Helvetica" 14' gnuplot> set output "speeds-output.ps" gnuplot> replot # Also, to get things in a color EPS format this was mentioned elsewhere gnuplot> set term postscript eps enhanced color Terminal type set to 'postscript' Options are 'eps enhanced color dashed defaultplex "Helvetica" 14' gnuplot> set output "speeds-output-color.ps" gnuplot> replot # Save plot to a file and quit gnuplot> save "speeds-output.plt" gnuplot> quit # Startup gnuplot and load a previously saved plot tjn: $ gnuplot gnuplot> load "speeds-output.plt" # To just load a plot and let gnuplot exit tjn: $ gnuplot -persist speeds-output.plt tjn: $ --------------------------------- + Bar Graphs - Using an addon pkg from http://www.io.com/~kazushi/freeware/bargraph.sh-1.2.gz with the GNU plotutils, i'm able to do simple bar graphs etc. I have these installed on my system and was able to generate something simple using the following data files [data1] 2 0.98 4 0.78 6 0.55 8 0.68 [data2] 2 0.25 4 0.39 6 0.77 8 0.98 tjn: $ /bargraph.sh -W .3 -T x -y 0 1 -X "number of processors" -Y "speedup" -q .2 data1 -q .3 data2 This gens a simple bargraph that is displayed on the console using the 'graph' command from 'plotutils'. You can change the output by using alt values for "-T", To list available fonts, type `graph -T "format" --help-fonts', where "format" is the output format: X, png, pnm, gif, svg, ai, ps, cgm, fig, pcl, hpgl, regis, or tek. # Gen graph and output to gif file tjn: $ /bargraph.sh -W .3 -T gif -y 0 1 -X "number of processors" \ > -Y "speedup" -q .2 data1 -q .3 data2 > graph.gif # Gen graph and output to fig file tjn: $ /bargraph.sh -W .3 -T fig -y 0 1 -X "number of processors" \ > -Y "speedup" -q .2 data1 -q .3 data2 > graph.fig # Gen graph and output to ps file tjn: $ /bargraph.sh -W .3 -T ps -y 0 1 -X "number of processors" \ > -Y "speedup" -q .2 data1 -q .3 data2 > graph.ps ---------------------------------