Creating multiplots with Gnuplot

#
# This file will create a stacked plot with 3 rows & 2 columns
#
set terminal png size 1200,900 linewidth 3
set output 'muliplot_sample.png'
set linestyle 1 linecolor rgb 'blue'
set linestyle 2 linecolor rgb 'red'
set multiplot layout 3,2 columnsfirst
#
# First plot top row first column
#
set tmargin at screen 0.95
set bmargin at screen 0.65
set lmargin at screen 0.05
set rmargin at screen 0.50
set xtics format ' '
set ytics -0.8,0.4,0.8
set xtics -8,2,8
plot cos(x) with lines linestyle 1
#
# Second plot middle row first column
#
set tmargin at screen 0.65
set bmargin at screen 0.35
set lmargin at screen 0.05
set rmargin at screen 0.50
plot cos(2*x) with lines linestyle 1
#
# Third plot bottom row first column
#
set tmargin at screen 0.35
set bmargin at screen 0.05
set lmargin at screen 0.05
set rmargin at screen 0.50
set xtics format '%g'
plot cos(3*x) with lines linestyle 1
#
# Fourth plot top row second column
#
set tmargin at screen 0.95
set bmargin at screen 0.65
set lmargin at screen 0.50
set rmargin at screen 0.95
set xtics format ' '
set ytics format ' '
plot sin(3*x) with lines linestyle 2
#
# Fifth plot middle row second column
#
set tmargin at screen 0.65
set bmargin at screen 0.35
set lmargin at screen 0.50
set rmargin at screen 0.95
plot sin(2*x) with lines linestyle 2
#
# Sixth plot bottom row second column
#
set tmargin at screen 0.35
set bmargin at screen 0.05
set lmargin at screen 0.50
set rmargin at screen 0.95
set xtics format '%g'
plot sin(x) with lines linestyle 2
unset multiplot

Copy the text and put it in a file called sample.p
Process it with gnuplot with:
gnuplot sample.p
which should produce a png file with six plots in it.