Blame demo/rgb_variable.dem

Packit 0986c0
#
Packit 0986c0
# Demo of reading color information from the data file itself
Packit 0986c0
#
Packit 0986c0
Packit 0986c0
#
Packit 0986c0
rgb(r,g,b) = int(r)*65536 + int(g)*256 + int(b)
Packit 0986c0
Packit 0986c0
#
Packit 0986c0
set border 0
Packit 0986c0
unset xtics; unset ytics; unset ztics
Packit 0986c0
set rmargin 5; set lmargin 5; set bmargin 2
Packit 0986c0
Packit 0986c0
set angle degrees
Packit 0986c0
xrgb(r,g,b) = (g-b)/255. * cos(30.)  
Packit 0986c0
yrgb(r,g,b) = r/255. - (g+b)/255. * sin(30.)
Packit 0986c0
set arrow 1 from 0,0 to 0,1 nohead lw 3 lc rgb "red" back
Packit 0986c0
set arrow 2 from 0,0 to cos(-30), sin(-30) nohead lw 3 lc rgb "green" back
Packit 0986c0
set arrow 3 from 0,0 to cos(210), sin(210) nohead lw 3 lc rgb "blue" back
Packit 0986c0
Packit 0986c0
set title "RGB color information read from data file"
Packit 0986c0
plot 'rgb_variable.dat' using (xrgb($1,$2,$3)):(yrgb($1,$2,$3)):(rgb($1,$2,$3)) \
Packit 0986c0
     with points pt 7 ps 4 lc rgb variable notitle
Packit 0986c0
pause -1 "Hit return to continue"
Packit 0986c0
Packit 0986c0
#
Packit 0986c0
set title "Both RGB color information\n and point size controlled by input"
Packit 0986c0
plot 'rgb_variable.dat' using (xrgb($1,$2,$3)):(yrgb($1,$2,$3)):(1.+2.*rand(0)):(rgb($1,$2,$3)) \
Packit 0986c0
     with points pt 7 ps var lc rgb variable notitle
Packit 0986c0
pause -1 "Hit return to continue"
Packit 0986c0
Packit 0986c0
#
Packit 0986c0
set border -1 front linetype -1 linewidth 1.000
Packit 0986c0
set ticslevel 0
Packit 0986c0
set xtics border
Packit 0986c0
set ytics border
Packit 0986c0
set ztics border
Packit 0986c0
#
Packit 0986c0
unset arrow 1
Packit 0986c0
unset arrow 2
Packit 0986c0
unset arrow 3
Packit 0986c0
#
Packit 0986c0
set xlabel "Red" tc rgb "red"
Packit 0986c0
set xrange [0:255]
Packit 0986c0
set ylabel "Green" tc rgb "green"
Packit 0986c0
set yrange [0:255]
Packit 0986c0
set zlabel "Blue" tc rgb "blue"
Packit 0986c0
set zrange [0:255]
Packit 0986c0
Packit 0986c0
#
Packit 0986c0
splot 'rgb_variable.dat' using 1:2:3:(rgb($1,$2,$3)) with points pt 7 ps 4 lc rgb variable, \
Packit 0986c0
      '' using 1:2:3:(sprintf("0x%x",rgb($1,$2,$3))) with labels left offset 1 notitle
Packit 0986c0
pause -1 "Hit return to continue"
Packit 0986c0
#
Packit 0986c0
#
Packit 0986c0
# Unfortunately, not all platforms allow us to read hexadecimal constants
Packit 0986c0
# from a data file. Warn the user if that is the case.
Packit 0986c0
#
Packit 0986c0
if (0 == int('0x01')) \
Packit 0986c0
   set label 99 at screen .05, screen .15 "If you see only black dots,\nthis means your platform does not \nsupport reading hexadecimal constants\nfrom a data file. Get a newer libc."
Packit 0986c0
Packit 0986c0
splot 'rgb_variable.dat' using 1:2:3:(5*rand(0)):4 with points pt 7 ps variable lc rgb variable \
Packit 0986c0
      title "variable pointsize and rgb color read as hexidecimal"
Packit 0986c0
Packit 0986c0
pause -1 "Hit return to continue"
Packit 0986c0
set label 99 ""
Packit 0986c0
#
Packit 0986c0
set border 0
Packit 0986c0
set xtics axis nomirror
Packit 0986c0
set ytics axis nomirror
Packit 0986c0
set ztics axis nomirror
Packit 0986c0
set xzeroaxis lt -1 lc rgb "red" lw 2
Packit 0986c0
set yzeroaxis lt -1 lc rgb "green" lw 2
Packit 0986c0
set zzeroaxis lt -1 lc rgb "blue" lw 2
Packit 0986c0
set xyplane at 0.0
Packit 0986c0
Packit 0986c0
splot 'rgb_variable.dat' using 1:2:3:(5*rand(0)):(rgb($1,$2,$3)) with points pt 7 ps variable lc rgb variable \
Packit 0986c0
      title "variable pointsize and rgb color computed from coords"
Packit 0986c0
pause -1 "Hit return to continue"
Packit 0986c0
Packit 0986c0
set title "Demo of hidden3d with points only (no surface)"
Packit 0986c0
set hidden3d
Packit 0986c0
replot
Packit 0986c0
pause -1 "Hit return to continue"
Packit 0986c0
reset
Packit 0986c0
#
Packit 0986c0
Packit 0986c0
RGB(R,G,B) =  int(255.*R) * 2**16 + int(255.*G) * 2**8  + int(255.*B)
Packit 0986c0
Packit 0986c0
set xr [0.01:1]
Packit 0986c0
set yr [0.01:1]
Packit 0986c0
set ur [0.01:1]
Packit 0986c0
set vr [0.01:1]
Packit 0986c0
set zr [0:1.065]
Packit 0986c0
set xtics ("R=1" 1)
Packit 0986c0
set ytics ("G=1" 1)
Packit 0986c0
set ztics ("0" 0, "B=1" 1)
Packit 0986c0
unset colorbox
Packit 0986c0
set isosamples 40,40
Packit 0986c0
set xyplane at 0.0
Packit 0986c0
set view 63,58,1.,1.4
Packit 0986c0
Packit 0986c0
set title "RGB coloring of pm3d surface"
Packit 0986c0
unset key
Packit 0986c0
Packit 0986c0
# Just some function that is well-defined in this range
Packit 0986c0
# (except at the origin)
Packit 0986c0
f(x,y) = 0.4 + sin(sqrt(100.*x**2+100.*y**2)) \
Packit 0986c0
       / (1.5*sqrt(100.*x**2+100.*y**2))
Packit 0986c0
Packit 0986c0
splot '++' using 1:2:(f($1,$2)):(RGB($1,$2,f($1,$2))) \
Packit 0986c0
       with pm3d lc rgb variable
Packit 0986c0
Packit 0986c0
pause -1 "Hit return to continue"
Packit 0986c0
Packit 0986c0
set title "HSV coloring of pm3d surface\n(V=1)"
Packit 0986c0
unset xtics
Packit 0986c0
unset ytics
Packit 0986c0
set ztics ("0" 0)
Packit 0986c0
set xlabel "H"
Packit 0986c0
set ylabel "S"
Packit 0986c0
Packit 0986c0
splot '++' using 1:2:(f($1,$2)):(hsv2rgb($1,$2,1.0)) \
Packit 0986c0
       with pm3d lc rgb variable
Packit 0986c0
Packit 0986c0
pause -1 "Hit return to continue"
Packit 0986c0
Packit 0986c0
set title "Explicit borders for pm3d tiling"
Packit 0986c0
set pm3d border lt black hidden3d
Packit 0986c0
set sample 10
Packit 0986c0
set isosample 10
Packit 0986c0
replot
Packit 0986c0
Packit 0986c0
pause -1 "Hit return to continue"
Packit 0986c0
Packit 0986c0
reset