set pdf
plot "data-simple" 1:2 lines, \
"data-simple" 1:3 linespoints

# simple plotting
plot '2col.dat' # assumes col1=x, col2=y; shows '+' at data points
plot '2col.dat' lines # connect points with a line

# plot a subset of the data
plot[1:5] '2col.dat' linespoints # plot the first 5 elements

# add a title to your line
plot '2col.dat' lines 'my curve' # this is really the line-title in the legend

# map the columns to the x- and y-axes
plot '2col.dat' 1:2 # 1=x, 2=y (this is the default)
plot '2col.dat' 2:1 # 2=x, 1=y (reverse the graph)

# abbreviations
plot '2col.csv' 1:2 l 'Squared' # 'u' - using, 'w l' - with lines

set 'Hello, world' # plot title
set 'Time' # x-axis label
set 'Distance' # y-axis label

# labels
set "boiling point" 10, 212

# key/legend
set top right
set box
set left bottom
set bmargin
set 0.01,100

set # no key

# arrow
set 1,1 5,10

set # multiplot mode (prompt changes to 'multiplot')
set 1, 0.5

set 0.0,0.5
plot sin(x), log(x)

set 0.0,0.0
plot sin(x), log(x), cos(x)

unset # exit multiplot mode (prompt changes back to 'gnuplot')

plot sin(x) 'Sine Function', tan(x) 'Tangent'

plot sin(x)
plot sin(x)/x

plot 'bp-hr.dat' 1:2 lp 'systolic', 'bp-hr.dat' 1:3 lp 'diastolic', 'bp-hr.dat' 1:4 lp 'heartrate'

set postscript color ##setting the term
set "multiple_files.ps"

set center ##legend placement

plot [1:5][1:120] \
for [i = 1:3] "file_".i.".dat" \
1.3 i+4 \
"file\_".i.".dat" \
linespoints


file_name(n) = sprintf("file_%d.dat", n)
plot for[i = 1:N] file_name(i) file_name(i)


# data blocks
$Mydata << EOD
11 22 33 first line of data
44 55 66 second line of data
# comments work just as in a data file
77 88 99
EOD
stats $Mydata 1:3
plot $Mydata 1:3 points, $Mydata 1:2 impulses

print '`hostname -s`: '."`hostname `"

style1 = "lines lt 4 lw 2"
style2 = "points lt 3 pt 5 ps 2"
range1 = "using 1:3"
range2 = "using 1:5"
plot "foo" @range1 @style1, "bar" @range2 @style2

v=0
if (v%2) {
print "2"
} else if (v%3) {
print "3"
} else {
print "fred"
}

v=v+1; if (v%2) print "2" ; else if (v%3) print "3"; else print "fred"

do for [N=1:5] {
plot func(N, x)
pause -1
}