Back to demo index

gnuplot demo script: contours.dem

autogenerated by webify.pl on Wed Mar 19 19:51:04 2014
gnuplot version gnuplot 5.0 patchlevel alpha
#
# $Id: contours.dem,v 1.17 2013/06/27 19:37:13 sfeam Exp $
#
set samples 20
set isosamples 21
set xlabel "X axis"
set ylabel "Y axis"
set zlabel "Z " offset 1, 0
set view 60, 30, 0.85, 1.1
set key at screen 1.0, 0.9
set style textbox opaque noborder margins 0.5, 0.5

set title "contour plot"
set contour
splot x*y

Click here for minimal script to generate this plot




set cntrparam levels 15
set title "more contours (15 levels)"
replot

Click here for minimal script to generate this plot




set cntrparam levels incr -100,10,100
set title "contour by increments (every 10, starting at -100)"
replot

Click here for minimal script to generate this plot




set cntrparam levels disc -75,-50,0
set title "discrete set of contours (at -75, -50, 0)"
replot

Click here for minimal script to generate this plot




set cntrparam levels auto 10
set view 60, 30, 1.0, 1.1
set title "contours on base grid with labels"
set contour base
set cntrlabel font ",7"
splot x**2-y**2 with lines, x**2-y**2 with labels boxed notitle

Click here for minimal script to generate this plot




set title "contours drawn on surface"
set contour surface
splot x**2-y**2 with lines notitle, x**2-y**2 with lines nosurf lw 3

Click here for minimal script to generate this plot




set title "contours on both base and surface"
set contour both
set hidden3d
splot x**2-y**2 with lines, x**2-y**2 with labels boxed notitle
unset hidden3d

Click here for minimal script to generate this plot




set contour base
set title "2 surfaces"
set key opaque
splot x**2*y**3, x**3*y**2

Click here for minimal script to generate this plot




set title "some more interesting contours"
unset key
splot x*y / (x**2 + y**2 + 0.1)

Click here for minimal script to generate this plot




set zrange [-1.0:1.0]
splot [x=-3:3] [y=-3:3] sin(x) * cos(y)

Click here for minimal script to generate this plot




set samples 6
set isosamples 6
set cntrparam levels 5
set title "low resolution (6x6)"
replot

Click here for minimal script to generate this plot




set title "low resolution (6x6) using cubic splines"
set cntrparam cubic
replot

Click here for minimal script to generate this plot




set cntrparam bspline
set title "low resolution (6x6) using bspline approx."
replot

Click here for minimal script to generate this plot




set cntrparam order 8
set title "low resolution (6x6) raise bspline order."
replot

Click here for minimal script to generate this plot




set samples 25
set isosamples 26
set key default at screen 1.0, 0.9
set title "contour of Sinc function"
splot [-5:5.01] [-5:5.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)

Click here for minimal script to generate this plot




splot [-12:12.01] [-12:12.01] sin(sqrt(x**2+y**2)) / sqrt(x**2+y**2)

Click here for minimal script to generate this plot




set cntrparam levels 10
set auto
set zrange [-1.0:1.0]
set style data lines
set title "contour of data grid plotting"
set parametric
splot "glass.dat"

Click here for minimal script to generate this plot




set xrange [0:15]
set yrange [0:15]
set zrange [-1.2:1.2]
unset parametric
splot "glass.dat" using 1

Click here for minimal script to generate this plot




set view map
unset key
unset surface
set title "2D contour projection of previous plot"
set cntrlabel start 2 font ",7"
splot "glass.dat" using 1 with lines, \
      "glass.dat" using 1 with labels boxed

Click here for minimal script to generate this plot




#
# The Rosenbrock function [HH Rosenbrock (1960) The Computer Journal 3:175–184]
#    (1-x)**2 + 100 * (y - x**2)**2
# is a well-known difficult test case for general purpose minimizers. 
#
set auto
set surface
unset contour
set cntrparam levels 5
set cntrparam linear
set samples 100
set logscale z
set hidden3d
set isosamples 60
set ticslevel 0.
set view 20,340	#HBB: ,1,2
set xlabel "x"
set ylabel "y"
Rosenbrock(x,y) = (1-x)**2 + 100*(y - x**2)**2

set title "Rosenbrock Function"
splot [-1.5:1.5] [-0.5:1.5] Rosenbrock(x,y)

Click here for minimal script to generate this plot




set contour
unset surface
unset ztics
unset zlabel
set border 15
replot

Click here for minimal script to generate this plot




#
set title "All contours drawn in a single color"
set cntrlabel onecolor
set cntrparam bspline
splot [-1.5:1.5] [-0.5:1.5] Rosenbrock(x,y) lc rgb "#007700"

Click here for minimal script to generate this plot




set title "Sometimes it helps to use multiplot"
set view map
set xr [-0.5:1.5]
set yr [0:1.5]
unset xlabel
unset ylabel
set tics scale 0.0
set lmargin at screen 0.1
set rmargin at screen 0.9
set bmargin at screen 0.1
set tmargin at screen 0.9

set multiplot

set cntrparam levels discrete 0.1, 1.0, 10.0, 100.0
set isosamples 500,100
splot Rosenbrock(x,y) with lines lc rgb "#007700"

set isosamples 50,50
set cntrlabel start 25 interval -1 font ",7"
splot Rosenbrock(x,y) with labels boxed

unset multiplot

Click here for minimal script to generate this plot




#
# Clean up:
#