1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#
# Illustrate uses of plotting with a watchpoint set
#
if (!strstrt(GPVAL_COMPILE_OPTIONS, "+WATCHPOINTS")) {
print "This copy of gnuplot does not support watchpoints"
exit # return to caller
}
set title "Find and mark intersection of two curves"
set key right reverse Left
unset link y2
set style watchpoint nolabel
set grid
set xrange [50:500]
plot 'silver.dat' using 1:($2 - ($0+$3)) watch y=0.0 lt nodraw
INTERSECT_X = WATCH_1[1]
plot 'silver.dat' using 1:2, '' using 1:($0+$3) watch x=INTERSECT_X
INTERSECT_Y = imag(WATCH_1[1])
show var INTERSECT
set label 1 at INTERSECT_X, INTERSECT_Y point pt 6 ps 3
set arrow 1 from INTERSECT_X, 0.1*INTERSECT_Y to INTERSECT_X, 0.8*INTERSECT_Y noborder
plot 'silver.dat' using 1:2 lw 2, '' using 1:($0+$3) lw 2, \
keyentry with point pt 6 lc "black" \
title sprintf("Intersection at [%.1f, %.1f]", INTERSECT_X, INTERSECT_Y)
pause -1 "<cr> to continue"
reset
if (!strstrt(GPVAL_COMPILE_OPTIONS, "+LIBCERF")) {
print "This copy of gnuplot does not support FresnelC, FresnelS"
exit;
}
unset key
set title "Find y intercepts of a parametric function" offset 0,-1
set xrange [-0.1 : 0.9]
set yrange [ 0.0 : 0.85]
set border 0
set xzeroaxis
set yzeroaxis
set xtics axis
set ytics axis
set sample 250
plot sample [t=-1:3.95] '+' using (FresnelC(t)) : (FresnelS(t)) with lines watch x=0.5 lt 3
show watchpoints
pause -1 "<cr> to replot with intercept labels constructed from WATCH_1 array"
set title "Intercept labels constructed from WATCH_1 array values" noenhanced
set for [i=1:|WATCH_1|] label i at real(WATCH_1[i]), imag(WATCH_1[i])
set for [i=1:|WATCH_1|] label i point pt 7 ps 0.5
set for [i=1:|WATCH_1|] label i sprintf("Hit %d at y = %.4f",i,imag(WATCH_1[i]))
replot
pause -1 "<cr> to continue"
reset
|