Skip to content

Latest commit

 

History

History
128 lines (91 loc) · 3.61 KB

gnuplot.mkd

File metadata and controls

128 lines (91 loc) · 3.61 KB

Draw multiple plots

set terminal postscript eps enhanced color
set ylabel "Performance (#files / unit)"
set xlabel "Time unit (1 unit is 5 seconds)" 

# comment to enable autoscale
set yrange [20:45]                          

set output "sysid_4threads.eps"
set size 1, 1
set origin 0, 0

set multiplot

set size 0.5, 0.5
set origin 0, 0
set title "Performance in SYSID (1st run, 4 threads)" 
plot "constant_sysid.txt" using 1 with line

set size 0.5, 0.5
set origin 0, 0.5
set title "Performance in SYSID (2nd run, 4 threads)" 
plot "constant_sysid.txt" using 2 with line

set size 0.5, 0.5
set origin 0.5, 0
set title "Performance in SYSID (3rd run, 4 threads)" 
plot "constant_sysid.txt" using 3 with line

set size 0.5, 0.5
set origin 0.5, 0.5
set title "Performance in SYSID (average, 4 threads)" 
plot "constant_sysid.txt" using 4 with line

# to continue other plots, we should unset previous multiplot first
unset multiplot

Using column 1 as X-axis and column 2 as Y-axis

gnuplot> set output 'figure.png'
gnuplot> set term png size 1200, 900
gnuplot> set output 'figure.png' 
gnuplot> set title 'Distribution of Length of Webpy Query'
gnuplot> plot 'data.txt' using 1:2 with lines

gamma distribution

http://en.wikipedia.org/wiki/File:Gamma_distribution_pdf.svg See gamma.gnuplot

rotate xtics label

http://gnuplot.sourceforge.net/demo/histograms.html

set xtics nomirror rotate by -45 font ",8"

adjust margin and label position

# move ylabel to the right by 3
set ylabel "Throughput (mb/sec)" offset 3,0

# set left margin to be 4-character wide
set lmarg 4

Set user-defined variable

gnuplot -e "a=2; s='file.png'" input.p

command line instructions

To give gnuplot commands directly in the command line, using the "-persist" option so that the plot remains on the screen afterwards:

gnuplot -persist -e "set title ’Sine curve’; plot sin(x)"

pre and post processing

To launch an interactive session after an initialization file "header" and followed by another command file "trailer":

gnuplot header - trailer

Coordinates

The commands set arrow, set key, set label and set object allow you to draw something at an arbitrary position on the graph. This position is specified by the syntax:

{<system>} <x>, {<system>} <y> {,{<system>} <z>}

Each can either be first, second, graph, screen, or character.

  • first places the x, y, or z coordinate in the system defined by the left and bottom axes; second places it in the system defined by the second axes (top and right);

  • graph specifies the area within the axes — 0,0 is bottom left and 1,1 is top right (for splot, 0,0,0 is bottom left of plotting area; use negative z to get to the base — see set xyplane (p. 163));

  • screen specifies the screen area (the entire area — not just the portion selected by set size), with 0,0 at bottom left and 1,1 at top right; and character gives the position in character widths and heights from the bottom left of the screen area (screen 0,0)

  • character coordinates depend on the chosen font size. If the coordinate system for x is not specified, first is used. If the system for y is not specified, the one used for x is adopted.

use inline data

plot "-" using 1:2
1 6
2 4
3 2
4 5
e

plot part of data file

See /home/mchen/greendm/results_new/online_traces_realtime/parse/thput/thput.py

plot "<(sed -n '2p' results.dat)" using 2:3:xticlabels(1) with histogram lw 2 notitle

set datafile separator

# Input file contains comma-separated values fields
set datafile separator ","