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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
|
# 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 postscript color enhanced
# 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 top
set border 4095
set xrange [-15:15]
set yrange [-15:15]
set zrange [-0.25:1]
set samples 25
set isosamples 20
set title "pm3d demo. Radial sinc function. Default options."
set pm3d; set palette
#show pm3d
#show palette
splot 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 0
set pm3d at s
set cblabel "colour gradient"
replot
pause -1 "Hit return to continue"
set title "pm3d at b (bottom)"
set pm3d at b
replot
pause -1 "Hit return to continue"
set title "unset surface; set pm3d at st (surface and top)"
unset surface
set pm3d at st
replot
pause -1 "Hit return to continue"
unset cblabel
set title "set pm3d at bstbst (funny combination, only for screen or postscript)"
set view 50,50
set pm3d at bstbst
replot
pause -1 "Hit return to continue"
set title "gray map"
set view map
set pm3d at b
set palette gray
set samples 100; set isosamples 100
replot
pause -1 "Hit return to continue"
set title "gray map, negative"
set palette gray negative
replot
pause -1 "Hit return to continue"
set title "colour map, using default rgbformulae 7,5,15 ... traditional pm3d (black-blue-red-yellow)"
set palette color positive
set samples 50; set isosamples 50
replot
pause -1 "Hit return to continue"
set title "colour, rgbformulae 3,11,6 ... green-red-violet"
set palette rgbformulae 3,11,6
replot
pause -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,3
replot
pause -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,32
replot
pause -1 "Hit return to continue"
set title "cubehelix color scheme with monotonic intensity\nD A Green (2011) http://arxiv.org/abs/1108.5083" offset 0,1
set palette cubehelix
replot
pause -1 "Hit return to continue"
test palette
pause -1 "Hit return to continue"
set title "rgbformulae 31,-11,32: negative formula number=inverted color"
set palette rgbformulae 31,-11,32
replot
pause -1 "Hit return to continue"
set yrange [*:*] noreverse
reset
set title "set pm3d scansforward: wrong, because back overwrites front"
set pm3d
set palette
set view 130,10
set samples 50; set isosamples 50
set border 4095
unset surface
set pm3d at s scansforward
splot sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)
pause -1 "Hit return to continue"
set title "set pm3d scansbackward: correctly looking surface"
set xlabel
set border 4095
set pm3d scansbackward
replot
pause -1 "Hit return to continue"
set title "set hidden3d"
set samples 30; set isosamples 30
set hidden3d
set pm3d
set surface
set view 50,220
set 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 depth sorting with line type 100
unset hidden
unset surface
set title "set pm3d depthorder border lc 'black' lw 1"
set samples 30; set isosamples 30
set pm3d
set style line 100 lt 5 lw 0.5
set pm3d depthorder border lc 'black' lw 1
set view 50,220
set xrange [-2:2]
set yrange [-2:2]
splot log(x*x*y*y)
pause -1 "Hit return to continue"
set pm3d
set title "bad: surface and top are too close together"
set xrange [-1:1]
set yrange [-1:1]
unset hidd
set zrange [-15:4]
set ticslevel 0
set pm3d at st
splot log(x*x*y*y)
pause -1 "Hit return to continue"
set title "solution: use independent 'set zrange' and 'set cbrange'"
unset surf
set 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 cb
set title "color box is on by default at a certain position"
set samples 20; set isosamples 20
set autoscale
set key on
set pm3d
set pm3d at s
set view 60,30
splot y
pause -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.25
set colorbox horizontal
set colorbox user origin 0.1,0.15 size 0.8,0.1
set mcbtics 2
set grid cb
set cblabel "see cblabel, grid cb, mcbtics, ..."
replot
pause -1 "Hit return to continue"
unset cblabel; unset mcbtics; set grid nocb; set colorbox default
set title "color box is switched off"
unset colorbox
replot
pause -1 "Hit return to continue"
set title 'using now "set grid back; unset colorbox"'
unset colorbox
set pm3d
set border 895
set grid back
replot
pause -1 "Hit return to continue"
set size 1,1; set origin 0,0
set grid layerdefault
set xlabel "X LABEL"
set ylabel "Y LABEL"
set sample 11; set isosamples 11
set view map
set palette
set colorbox
set lmargin 0
set pm3d flush begin
set title "Datafile with different nb of points in scans; pm3d flush begin"
set pm3d flush begin noftriangles scansforward
splot 'triangle.dat'
pause -1 "Hit return to continue"
set title "Datafile with different nb of points in scans; pm3d flush center"
set pm3d flush center scansforward
replot
pause -1 "Hit return to continue"
set title "Datafile with different nb of points in scans; pm3d flush end"
set pm3d flush end scansforward
replot
pause -1 "Hit return to continue"
set grid front
set pm3d flush begin
set title "Data with different nb of points in scans; pm3d ftriangles flush begin"
set pm3d flush begin ftriangles scansforward
splot 'triangle.dat'
#show pm3d
pause -1 "Hit return to continue"
set title "Data with different nb of points in scans; pm3d ftriangles flush center"
set pm3d flush center ftriangles scansforward
replot
pause -1 "Hit return to continue"
set title "Data with different nb of points in scans; pm3d ftriangles flush end"
set pm3d flush end ftriangles scansforward
replot
pause -1 "Hit return to continue"
set title "Using interpolation with datafile; pm3d interpolate 2,1"
set pm3d flush begin noftriangles scansforward interpolate 2,1
replot
pause -1 "Hit return to continue"
set title "Using interpolation with datafile; pm3d ftriangles interpolate 10,1"
set pm3d flush begin ftriangles scansforward interpolate 10,1
replot
pause -1 "Hit return to continue"
set title "Using interpolation with datafile; pm3d at s ftriangles interpolate 10,1"
set pm3d flush begin ftriangles scansforward at s interpolate 10,1
set view 20,20
replot
pause -1 "Hit return to continue"
reset
set title "only for enhanced terminals: 'set format cb ...'"
set xlabel "X"
set ylabel "Y"
set sample 31; set isosamples 31
set xrange [-185:185]
set yrange [-185:185]
set format cb "%.01t*10^{%T}"
unset surface
set border 4095
set ticslevel 0
set pm3d at s; set palette gray
set cblabel "the colour gradient"
splot abs(x)**3+abs(y)**3
pause -1 "Hit return to continue"
unset cblabel
set pal color
set xrange [*:*]; set yrange [*:*]
set title "function 'x+y' using all colors available, 'set pal maxcolors 0'"
set pal maxcolors 0
splot x+y
pause -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 5
splot x+y
pause -1 "Hit return to continue"
set pal maxcolors 0
unset pm3d
set surface
set format z
set palette
set title "color lines: 'splot sin(y)/(y) with lines palette'"
set ticslevel 0
set border 4095
set xrange [-10:10]; set yrange [-10:10]
set hidden3d
set isosamples 40,40; set samples 40,40
splot sin(y)/(y) w lines palette
pause -1 "Hit return to continue"
reset
sinc(u,v) = sin(sqrt(u**2+v**2)) /sqrt(u**2+v**2)
set sam 40
set iso 40
set title "pm3d explicit mode --- coloring according to the 4th parameter of 'using'"
set ticslevel 0
set pm3d at s explicit
# '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 l
pause -1 "Hit return to continue"
set title "coloring according to the 3rd 'using' parameter (left) and to the z-value (bottom)"
set border 895
splot \
'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 pm3d
pause -1 "Hit return to continue"
reset
print "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 at b
set view map
set style func pm3d
set iso 4
set samples 4
set xrange [0:3]
set yrange [0:3]
set cbrange [0:9]
f(x,y)=2*x+y
set key off
unset xtics
unset ytics
unset colorbox
set bmargin 0
# Note: no more space in the following multiplot to show demo for
#set pm3d corners2color median
#set pm3d corners2color geomean
set multiplot title "set pm3d corners2color mode"
# Let us do multiplot grid 3x3:
dx = 1.0/3; dy = 1.0/3;
set size dx,dy
set origin 0*dx,0*dy
set title "c1"
set pm3d corners2color c1
splot f(x,y)
set origin 2*dx,0*dy
set title "c2"
set pm3d corners2color c2
replot
set origin 0*dx,2*dy
set title "c3"
set pm3d corners2color c3
replot
set origin 2*dx,2*dy
set title "c4"
set pm3d corners2color c4
replot
set origin 1*dx,2*dy
set title "mean"
set pm3d corners2color mean
replot
set origin 2*dx,1*dy
set title "geomean"
set pm3d corners2color geomean
replot
set origin 1*dx,0*dy
set title "median"
set pm3d corners2color median
replot
set origin 0*dx,1*dy
set title "harmean"
set pm3d corners2color harmean
replot
set origin 1*dx,1*dy
set title "Original grid points"
unset pm3d
set border 0
unset xtics
unset ytics
unset colorbox
#splot x*2+y with points ps 3 pt 5 palette
splot f(x,y) with linesp ps 3 pt 5 palette
unset multiplot
pause -1 "Hit return to continue"
reset
print "End of pm3d demo."
|