#### Testing RGB Palettes in Gnuplot #### reset gpversion=4.6 flggrid=1 flgplot=3 ## File selection ######## strgpath='./' strgpath='RGB_palettes/' strgname='nebula2.rgb' strgname='spin.rgb' strgname='spin18.rgb' strgname='spin24.rgb' #strgname='spin111.rgb' #strgname='spin111-20.rgb' #strgname='sphseq4.rgb' strgname='colorhelix.rgb' strgfile=strgpath.strgname maxlevel=1. ## test params -- comment out to use weights from previous call qexp=1.#default #qexp=1./1.25#reference gamma wr=0.30; wg=0.59; wb=0.11 # NTSC #wr=0.299; wg=0.587; wb=0.114 # PAL #wr=0.2126;wg=0.7152;wb=0.0722# HDTV #wr=.212673;wg=.715152;wb=.072175 # sRGB to XYZ, preset=4 print 'testpalette: wr,wg,wb,q =',wr,wg,wb,qexp ## fw(r,g,b)=wr*r/maxlevel+wg*g/maxlevel+wb*b/maxlevel frgb(r,g,b)=int(255./maxlevel*r)*65536 + int(255./maxlevel*g)*256 + int(255./maxlevel*b) fggg(r,g,b)=int(255.*fw(r,g,b))*65536 + int(255.*fw(r,g,b))*256 + int(255.*fw(r,g,b)) ########################## if (flgplot==1 || flgplot==3) set term x11 1 size 640,480 lws=2. set style line 1 lt 1 lw 1.00*lws lc rgb '#ff0000' set style line 2 lt 1 lw 1.00*lws lc rgb '#00aa00' set style line 3 lt 1 lw 1.00*lws lc rgb '#0000ff' set style line 4 lt 1 lw 1.00*lws lc rgb '#000000' set style line 5 lt 1 lw 1.00*lws lc rgb variable set style line 6 lt 1 lw 0.75*lws lc rgb '#7f7f7f' set style line 10 lt 1 lw 0.50*lws lc rgb '#000000' set style line 11 lt 1 lw 0.50*lws lc rgb '#888888' set style line 12 lt 1 lw 0.50*lws lc rgb '#bbbbbb' set border ls 10 dy=0.0 set xrange [0:1] set yrange [-dy:1.+dy] set xtics 0.1; set mxtics 5; set ytics 0.1; set mytics 5 set autoscale x #set xlabel 'color level'; set ylabel 'intensity' set key left if (flgplot==1 || flgplot==3) \ set multiplot ;\ set grid xtics ytics mxtics mytics ls 11, ls 12;\ set lmargin screen 0.05; set rmargin screen 0.99;\ set bmargin screen 0.20; set tmargin screen 0.99;\ plot strgfile using 1:2 t 'red' w l ls 1,\ strgfile using 1:3 t 'green' w l ls 2,\ strgfile using 1:4 t 'blue' w l ls 3,\ strgfile using 1:(fw($2,$3,$4)) t 'gray' w l ls 4,\ x**qexp w l ls 6;\ unset grid;\ set tics front;\ set format x "";\ set bmargin screen 0.08; set tmargin screen 0.15;\ set palette file strgfile u 1:2:3:4;\ set xrange [0:1];set cbrange [0:1]; unset ytics;\ set samples 1000;set isosamples 200,2;\ plot '++' using 1:2:1 with image;\ set bmargin screen 0.00; set tmargin screen 0.07;\ set palette file strgfile u 1:(fw($2,$3,$4)):(fw($2,$3,$4)):(fw($2,$3,$4));\ set xrange [0:1];set cbrange [0:1]; unset ytics;\ set samples 1000;set isosamples 200,2;\ plot '++' using 1:2:1 with image;\ unset multiplot set format x "%g" if (flgplot<2) q set tics back #set lmargin screen 0; set rmargin screen 1 #set bmargin screen 0; set tmargin screen 1 set lmargin; set rmargin; set bmargin; set tmargin ################################## #set term postscript # dummy set size noratio if (gpversion<4.5) set term x11 2 size 720,720 if (gpversion>=4.5) set term x11 2 size 720,720 background '#cccccc' kzoom=1.2 kscal=1. set border ls 4 set xyplane 0 set view equal xyz set view 0,0,kzoom set view 54.73561032,135,kzoom dx=0.0;dy=0.0;dz=0.0 set xlabel 'red'; set ylabel 'green'; set zlabel 'blue' set xrange [-dx:1.+dx];set yrange [-dy:1.+dy];set zrange [-dz:1.+dz] set xtics 0.1 in; set ytics 0.1; set ztics 0.1 unset mxtics; unset mytics; unset mztics unset key if (gpversion<4.5) \ splot strgfile using 2:2:2 w l ls 1,\ strgfile using 2:3:4 w l ls 4 if (gpversion>=4.5) \ splot strgfile using (fw($2,$3,$4)):(fw($2,$3,$4)):(fw($2,$3,$4)):(fggg($2,$3,$4)) w l lt 1 lw 1.0*lws lc rgb variable,\ strgfile using ($2/maxlevel):($3/maxlevel):($4/maxlevel):(frgb($2,$3,$4)) w l lt 1 lw 1.0*lws lc rgb variable #pause -1 #set term x11 1 close #set term x11 2 close #load 'testcolor.gp'