Gnuplot

From WTFwiki
Revision as of 16:30, 9 January 2020 by Jontow (talk | contribs) (add gnuplot example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

If you have some means of generating or obtaining a file with a single number (float|int) per line, you can easily turn this into a line and/or point graph with gnuplot, like so:

Create a file named plot.pg:

 #!/usr/bin/env gnuplot
 #
 ## Generate jobs.dat data file with:
 # $ generate_data >jobs.dat
 #
 ## Optionally, drop top 5th percentile:
 # $ sort -n jobs.dat | awk '{all[NR] = $0} END{print all[int(NR*0.95 - 0.5)]}'
 # 552.059
 # $ awk '$1 < 552.059' jobs.dat >jobs-95th.dat
 #
 ## Generate jobs.png graph with:
 # $ ./plot.pg >jobs.png
 #
 
 reset
 set terminal png
 
 #set yrange [0:1000]
 set ylabel "elapsed time"
 
 # Uncomment the one that you want
 #plot "jobs-95th.dat" with lines
 plot "jobs.dat" with lines