📄 pm3d.dem
字号:
## $Id: pm3d.dem,v 1.11 2003/12/15 09:58:33 mikulik Exp $## demo for pm3d splotting## This demo can be directly used if your default terminal supports pm3d, # like OS/2 Presentation Manager, X11, Linux VGA, Windows.# Otherwise you can use the output to postscript, for example:# set term push; set term post color enha;# set out 'pm3d_demo.ps'# load 'pm3d.dem'# set out; set term pop# Prepared by Petr Mikulik# History:# - 12. 3. 2003 pm: added demo for corners2color# - 9. 3. 2002 pm: added demo for ftriangles# - 31. 1. 2002 pm: removed pm3d/demo and stand-alone pm3d.dem in demo/# - 29. 1. 2002 joze: added demo for the 4th column# - 18. 3. 2001 pm: updated for cb-axis# - 18.11. 2000 pm: updated for 'set colorbox'# - 03. 3. 2000 joze: updated to show new pm3d features# - 15. 6. 1999 pm: update for `set pm3d`+`set palette`# - 29. 4. 1999 pm: the 1st version, directory pm3d/demo# print "WARNING: This demo works only on terminals supporting pm3d, i.e. on "# print "-------- OS/2 Presentation Manager, X11, Linux VGA, Windows. Please use"# print " output to a postscript file otherwise."set xlabel "x"set ylabel "y"set key topset border 4095set xrange [-15:15]set yrange [-15:15]set zrange [-0.25:1]set samples 25set isosamples 20set title "pm3d demo. Radial sinc function. Default options."set pm3d; set palette#show pm3d#show palettesplot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)pause -1 "Hit return to continue"set title "pm3d at s (surface) / ticslevel 0"set ticslevel 0set pm3d at sset cblabel "colour gradient"replotpause -1 "Hit return to continue"set title "set pm3d solid; the surface hides part of border, tics and labels"set pm3d solidreplotpause -1 "Hit return to continue"set pm3d transparentset title "pm3d at b (bottom)"set pm3d at breplotpause -1 "Hit return to continue"set title "unset surface; set pm3d at st (surface and top)"unset surfaceset pm3d at st solidreplotpause -1 "Hit return to continue"unset cblabelset title "set pm3d at bstbst (funny combination, only for screen or postscript)"set view 50,50set pm3d at bstbstreplotpause -1 "Hit return to continue"set pm3d transparentset title "gray map"set pm3d mapset palette grayset samples 100; set isosamples 100replotpause -1 "Hit return to continue"set title "gray map, negative"set pm3d mapset palette gray negativereplotpause -1 "Hit return to continue"set title "colour map, using default rgbformulae 7,5,15 ... traditional pm3d (black-blue-red-yellow)"set palette color positiveset pm3d mapset samples 50; set isosamples 50replotpause -1 "Hit return to continue"set title "colour, rgbformulae 3,11,6 ... green-red-violet"set palette rgbformulae 3,11,6replotpause -1 "Hit return to continue"set title "colour, rgbformulae 23,28,3 ... ocean (green-blue-white); OK are also all other permutations"set palette rgbformulae 23,28,3replotpause -1 "Hit return to continue"set title "colour, rgbformulae 30,31,32 ... color printable on gray (black-blue-violet-yellow-white)"set palette rgbformulae 30,31,32replotpause -1 "Hit return to continue"set title "rgbformulae 31,-11,32: negative formula number=inverted color"set palette rgbformulae 31,-11,32replotpause -1 "Hit return to continue"set yrange [*:*] noreverseresetset title "surface at view 130,10 (viewed from below)"set pm3dset paletteset view 130,10set samples 50; set isosamples 50set border 4095unset surfaceset pm3d at s scansforwardsplot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)pause -1 "Hit return to continue"set title '"set pm3d scansbackward" makes this as viewed from above'set xlabelset border 4095set pm3d scansbackwardreplotpause -1 "Hit return to continue"set title "set hidden3d"set samples 30; set isosamples 30set hidden3dset pm3dset surfaceset view 50,220set xrange [-2:2]set yrange [-2:2]splot log(x*x*y*y)pause -1 "Hit return to continue"unset hidden3d# draw the surface using pm3d's hidden3d with line type 100unset hiddenunset surfaceset title "set pm3d hidden3d <linetype>: pm3d's much faster hidden3d variant"set samples 30; set isosamples 30set pm3dset style line 100 lt 5 lw 0.5set pm3d solid hidden3d 100set view 50,220set xrange [-2:2]set yrange [-2:2]splot log(x*x*y*y)pause -1 "Hit return to continue"set pm3d nohidden3dset title "bad: surface and top are too close together"set xrange [-1:1]set yrange [-1:1]unset hiddset zrange [-15:4]set ticslevel 0set pm3d at stsplot log(x*x*y*y)pause -1 "Hit return to continue"set title "solution: use independent 'set zrange' and 'set cbrange'"unset surfset cbrange [-15:4]set zrange [-15:60]splot log(x*x*y*y)pause -1 "Press Enter; I will continue by 'set autoscale cb' and much more..."set autoscale cbset title "color box is on by default at a certain position"set samples 20; set isosamples 20set autoscaleset key onset pm3dset pm3d at sset view 60,30splot ypause -1 "Hit return to continue"set title "color box is on again, now with horizontal gradient"set size 0.6,0.6; set origin 0.2,0.25set colorbox horizontalset colorbox user origin 0.1,0.15 size 0.8,0.1set mcbtics 2set grid cbset cblabel "see cblabel, grid cb, mcbtics, ..."replot pause -1 "Hit return to continue"unset cblabel; unset mcbtics; set grid nocb; set colorbox defaultset title "color box is switched off"unset colorboxreplot pause -1 "Hit return to continue"set title 'using now "set pm3d solid; set grid back; unset colorbox"'unset colorboxset pm3d solidset border 895set grid backreplot pause -1 "Hit return to continue"set size 1,1; set origin 0,0set grid layerdefaultset xlabel "X LABEL"set ylabel "Y LABEL"set sample 11; set isosamples 11set pm3d mapset paletteset colorboxset lmargin 0set pm3d flush beginset title "Datafile with different nb of points in scans; pm3d flush begin"set pm3d flush begin noftriangles scansforwardsplot 'triangle.dat'#show pm3dpause -1 "Hit return to continue"set title "Datafile with different nb of points in scans; pm3d flush center"set pm3d flush center scansforwardreplotpause -1 "Hit return to continue"set title "Datafile with different nb of points in scans; pm3d flush end"set pm3d flush end scansforwardreplotpause -1 "Hit return to continue"set grid frontset pm3d flush beginset title "Data with different nb of points in scans; pm3d ftriangles flush begin"set pm3d flush begin ftriangles scansforwardsplot 'triangle.dat'#show pm3dpause -1 "Hit return to continue"set title "Data with different nb of points in scans; pm3d ftriangles flush center"set pm3d flush center ftriangles scansforwardreplotpause -1 "Hit return to continue"set title "Data with different nb of points in scans; pm3d ftriangles flush end"set pm3d flush end ftriangles scansforwardreplotpause -1 "Hit return to continue"resetset title "only for enhanced terminals: 'set format cb ...'"set xlabel "X"set ylabel "Y"set sample 31; set isosamples 31set xrange [-185:185]set yrange [-185:185]set format cb "%.01t*10^{%T}"unset surfaceset border 4095set ticslevel 0set pm3d at s solid; set palette grayset cblabel "the colour gradient"splot abs(x)**3+abs(y)**3pause -1 "Hit return to continue"unset cblabelset pal colorset xrange [*:*]; set yrange [*:*]set title "function 'x+y' using all colors available, 'set pal maxcolors 0'"set pal maxcolors 0splot x+ypause -1 "Hit return to continue"set xrange [*:*]; set yrange [*:*]set title "function 'x+y' using only 5 colors, 'set pal maxcolors 5'"set pal maxcolors 5splot x+ypause -1 "Hit return to continue"set pal maxcolors 0unset pm3dset surfaceset format zset paletteset title "color lines: 'splot sin(y)/(y) with linespoints palette'"set ticslevel 0set border 4095set xrange [-10:10]; set yrange [-10:10]set hidden3dset isosamples 40,40; set samples 40,40splot sin(y)/(y) w lp palettepause -1resetset title "Demo for clipping of 2 rectangles comes now. The xrange is [0:2]..."set pm3d; set paletteset pm3d mapset xrange [0:2]splot 'clip14in.dat'pause -1 "Hit return to continue"set xrange [0:1.5]set yrange [*:*]set title "...and now xrange is [0:1.5] and 'set pm3d clip1in'"set pm3d clip1inreplotpause -1 "Hit return to continue"set title "...now xrange is [0:1.5] and 'set pm3d clip4in'"set pm3d clip4inreplotpause -1 "Hit return to continue"resetsinc(u,v) = sin(sqrt(u**2+v**2)) /sqrt(u**2+v**2)set sam 40set iso 40set title "pm3d explicit mode --- coloring according to the 4th parameter of 'using'"set ticslevel 0set pm3d at s explicit solid# 'binary2' binary u 1:2:(column(3)+column(-1)/20.0):3 w pm3d, splot \ 'binary2' binary u 1:2:3:($2+($1+$2)/10) w pm3d, \ 1+sinc(x*4, y*4) w lpause -1 "Hit return to continue"set title "coloring according to the 3rd 'using' parameter (left) and to the z-value (bottom)"set border 895splot \ 'binary2' binary u 2:(12 - column(3) * 10):1 notitle w lines, \ 'binary2' binary u (-12 + column(3) * 10):2:1:(-12 + column(3) * 10) notitle w pm3d, \ 'binary2' binary u 1:2:(column(3) * 10 - 12) notitle w pm3dpause -1 "Hit return to continue"resetprint "Plot by pm3d algorithm draws quadrangles filled with color calculated from"print "the z- or color-value of the surrounding 4 corners. The following demo shows"print "different color spots for a plot with very small number of quadrangles (here"print "rectangular pixels). Note that the default option is 'mean'."set pm3d mapset iso 4set samples 4set xrange [0:3]set yrange [0:3]set cbrange [0:9]f(x,y)=2*x+yset key offunset xticsunset ytics# Needed by terminals limited on colors:#set palette maxcolors 26# Note: no more space in the following multiplot to show demo for#set pm3d corners2color median#set pm3d corners2color geomeanset multiplot# Let us do multiplot grid 3x3:dx = 1.0/3; dy = 1.0/3;set size dx,dyset origin 0*dx,0*dyset title "set pm3d corners2color c1"set pm3d corners2color c1splot f(x,y)set origin 2*dx,0*dyset title "set pm3d corners2color c2"set pm3d corners2color c2replotset origin 0*dx,2*dyset title "set pm3d corners2color c3"set pm3d corners2color c3replotset origin 2*dx,2*dyset title "set pm3d corners2color c4"set pm3d corners2color c4replotset origin 0*dx,1*dyset title "set pm3d corners2color mean"set pm3d corners2color meanreplotset origin 2*dx,1*dyset title "set pm3d corners2color geomean"set pm3d corners2color geomeanreplotset origin 1*dx,0*dyset title "set pm3d corners2color median"set pm3d corners2color medianreplotset origin 1*dx,1*dyset title "Original grid points"unset pm3dset border 0unset xticsunset yticsunset colorbox#splot x*2+y with points ps 3 pt 5 palettesplot f(x,y) with linesp ps 3 pt 5 paletteunset multiplotpause -1 "Hit return to continue"resetprint "End of pm3d demo."
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -