Back to demo index

gnuplot demo script: iterate.dem

autogenerated by webify.pl on Tue Jun 6 18:12:58 2017
gnuplot version gnuplot 5.2 patchlevel rc2
set title "Iteration within plot command"
set xrange [0:3]
set label 1 "plot for [n=2:10] sin(x*n)/n" at graph .95, graph .92 right
plot for [n=2:10] sin(x*n)/n notitle lw (13-n)/2

Click here for minimal script to generate this plot




set title "Iteration over all available data in a file"
set view 38., 341.
unset xtics
unset ytics
unset ztics
set border 0
set lmargin at screen 0.09
set rmargin at screen 0.90
set key outside below samplen 0.6
set key title "splot for [scan=1:*] 'whale.dat' index scan"
set key maxrows 6
splot for [i=1:*] "whale.dat" index i title sprintf("scan %d",i) with lines

Click here for minimal script to generate this plot





# Dynamic reevaluation of iteration limits
# inner loop refers to the control variable of an outer loop
#
set key opaque box height 1 title "Dynamic iteration limits"
set title "plot for [i=1:4] for [k=i:i] for [j=1:k] 10*k + cos(j*x)"
plot for [i=1:4] for [k=i:i] for [j=1:k] 10*k + cos(j*x) lw j \
     title sprintf("k=%d  j=%d", i, j)

Click here for minimal script to generate this plot