File: watch_contours.dem

package info (click to toggle)
gnuplot 6.0.3%2Bdfsg1-1~exp2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 14,960 kB
  • sloc: ansic: 95,874; cpp: 7,199; makefile: 2,470; javascript: 2,339; sh: 1,531; lisp: 664; perl: 304; pascal: 191; tcl: 88; python: 46
file content (43 lines) | stat: -rw-r--r-- 1,198 bytes parent folder | download
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
#
# Use watchpoints to place labels on contour lines, but only
# at positions constrained to lie along a line
#
unset key
set xrange [-1 : 4]
set yrange [-3 : 3]
set zrange [-10 : 10]
f(x,y) = x**2 + y**2 * (1 - x)**3
set samples 51
set isosamples 51
set linetype 104 lc "dark-blue"
set cntrparam firstlinetype 101

set view map

set title "Contour label placement constrained by watchpoint function \n guide lines shown in gray"
set tics scale 0.0

set style textbox  opaque margins  0.5,0.5 fc  bgnd noborder
set style watch labels nopoint center font ",10" 

line1(x,y) = y - (1.1*x -1)
line2(x,y) = y + x - 0.9

set multiplot

unset contours
splot '+' using 1:(0):(0)          with lines lw 0.5 lc "gray", \
      '+' using 1:(1.1*$1 - 1):(0) with lines lw 0.5 lc "gray", \
      '+' using 1:(-$1 + 0.9):(0)  with lines lw 0.5 lc "gray"

set contours base
set cntrparam levels incr -9,3, 9

splot f(x,y) with lines nosurface lw 2 watch y=0 label sprintf("%2d", int(z)), \
      f(x,y) with lines nosurface lt nodraw watch line1(x,y)=0 label sprintf("%2d ", int(z)), \
      f(x,y) with lines nosurface lt nodraw watch line2(x,y)=0 label sprintf("%2d ", int(z))

unset multiplot

pause -1
reset