#
# Demonstrate use of 'set {btlr}margin at screen <value>'
# to pin plot borders to a specific place on the canvas.
# This allows positioning multiple plots on the page so that their
# corners line up perfectly.
#
# Aug 2006 - Ethan A Merritt
#

set multiplot title "Demo of placing multiple plots (2D and 3D)\nwith explicit alignment of plot borders"

#
# First plot  (large)
#
set lmargin at screen 0.20
set rmargin at screen 0.85
set bmargin at screen 0.25
set tmargin at screen 0.85

set pm3d
set palette rgbformulae 7, 5, 15
set view map
set samples 50, 50
set isosamples 50, 50
unset surface
set xrange [ -15.00 : 15.00 ]
set yrange [ -15.00 : 15.00 ]
set zrange [ -0.250 : 1.000 ]

unset xtics
unset ytics

unset key

splot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)

unset pm3d
unset key

#
# second plot  (tall and narrow; at left of main plot)
#
set lmargin at screen 0.10
set rmargin at screen 0.20

set ytics

set parametric
set dummy u,v
set view map

f(h) = sin(sqrt(h**2))/sqrt(h**2)

set urange [ -15.00 : 15.00 ]
set vrange [ -15.00 : 15.00 ]
set xrange [*:*]
set surface

splot f(u), u, 0 with lines lc rgb "green"

unset parametric

#
# third plot  (short and wide; at bottom of main plot)
#
set lmargin at screen 0.20
set rmargin at screen 0.85
set bmargin at screen 0.10
set tmargin at screen 0.25

set xrange [ -15.00 : 15.00 ]
set yrange [ * : * ]
set xtics
unset ytics

y = 0
plot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)

unset multiplot

pause -1 "Hit return to continue"
reset
