#
# $Id: pm3dcolors.dem,v 1.3 2006/03/23 17:53:04 mikulik Exp $
#
# Test of new color modes for pm3d palettes.

#
#   Gradient Palettes
#
set pm3d; set palette
set palette color
set pm3d map
set cbrange [-10:10]
set xrange [-10:10]
set yrange [*:*]
unset ztics
unset ytics
set samples 101
set isosamples 2
set xtics 2

set palette model RGB

set palette defined 
set title "set palette defined"
splot x
pause -1 "Hit return to continue"


set palette defined (0 0 0 0, 1 0 0 1, 3 0 1 0, 4 1 0 0, 6 1 1 1)
set title 'set palette defined (0 0 0 0, 1 0 0 1, 3 0 1 0, 4 1 0 0, 6 1 1 1)'
splot x
pause -1 "Hit return to continue"


set palette defined ( 0 "green", 1 "blue", 2 "red", 3 "orange" ) 
set title 'set palette defined ( 0 "green", 1 "blue", 2 "red", 3 "orange" )'
splot x
pause -1 "Hit return to continue"


set palette defined ( 20 "#101010", 30 "#ff0000", 40 "#00ff00", 50 "#e0e0e0" ) 
set title 'set palette defined ( 20 "#101010", 30 "#ff0000", 40 "#00ff00", 50 "#e0e0e0" )'
splot x
pause -1 "Hit return to continue"


set palette defined ( 0 0 0 0, 1 1 1 1 )
set title 'set palette defined ( 0 0 0 0, 1 1 1 1 )'
splot x
pause -1 "Hit return to continue"


set palette model HSV defined ( 0 0 1 1, 1 1 1 1 )
set title 'set palette model HSV defined ( 0 0 1 1, 1 1 1 1 )'
splot x
pause -1 "Hit return to continue"


set palette model RGB
set palette model RGB defined (0 "green", 1 "dark-green", 1 "yellow", 2 "dark-yellow", 2 "red", 3 "dark-red" )
set title "set palette model RGB defined\n(0 'green', 1 'dark-green', 1 'yellow', 2 'dark-yellow', 2 'red', 3 'dark-red' )"
splot x
pause -1 "Hit return to continue"


set palette model RGB


set title 'set palette file "-" (file with 3 columns)'
set palette file "-"
0 0 0
0 0 1
0 1 0
1 0 0
1 1 1
e
splot x
pause -1 "Hit return to continue"


set title 'set palette file "-" (file with 4 columns)'
set palette file "-"
10 0 0 0
20 0 0 1
40 0 1 0
60 1 0 0
70 1 1 1
e
splot x
pause -1 "Hit return to continue"


set title 'set palette file "-" using 1:2:($1+$2)/2'
set palette file "-" using ($0):1:2:(($1+$2)/2)
0 0
0 1
1 0
1 1
e
splot x
pause -1 "Hit return to continue"



#
#    Color Models
#
set palette color
set pm3d map
set cbrange [-10:10]
set xrange [-10:10]
unset ztics
unset ytics
set samples 101
set isosamples 2
set xtics 2

set palette rgbformulae 7,5,15

set palette model RGB rgbformulae 7,5,15
set title "set palette model RGB rgbformulae 7,5,15"
splot x
pause -1 "Hit return to continue"


set palette model HSV rgbformulae 7,5,15
set title "set palette model HSV rgbformulae 7,5,15"
splot x
pause -1 "Hit return to continue"


set palette model XYZ rgbformulae 7,5,15
set title "set palette model XYZ rgbformulae 7,5,15"
splot x
pause -1 "Hit return to continue"


set palette model CMY rgbformulae 7,5,15
set title "set palette model CMY rgbformulae 7,5,15"
splot x
pause -1 "Hit return to continue"


set palette model YIQ rgbformulae 7,5,15
set title "set palette model YIQ rgbformulae 7,5,15"
splot x
pause -1 "Hit return to continue"


set palette model HSV rgbformulae 3,2,2
set title "set palette model HSV rrgbformulae 3,2,2"
splot x
pause -1 "Hit return to continue"



#
#   User Defined Functions
#
set palette color
set pm3d map
set cbrange [-10:10]
set xrange [-10:10]
set yrange [0:1]
unset ztics
unset ytics
set samples 101
set isosamples 2
set xtics 2

set palette model RGB

set palette functions gray, gray, gray
set title "set palette functions gray, gray, gray"
splot x
pause -1 "Hit return to continue"


set palette functions sqrt(gray), gray**3, sin(gray*2*pi) 
set title 'set palette functions sqrt(gray), gray**3, sin(gray*2*pi)  <--> 7,5,15'
splot x
pause -1 "Hit return to continue"


set palette rgbformulae 7,5,15
set title 'set palette rgbformulae 7,5,15'
splot x
pause -1 "Hit return to continue"


set palette model XYZ functions gray**0.35, gray**0.5, gray**0.8
set title 'set palette model XYZ functions model XYZ  gray**0.35, gray**0.5, gray**0.8'
splot x
pause -1 "Hit return to continue"


theta(x) = x<0 ? 0 : 1
r(x) = 4*x*(1-theta(x-0.25))
g(x) = 0.5*theta(x-0.25)*(1-theta(x-0.5))
b(x) = x
set palette model RGB functions r(gray),g(gray),b(gray)
set title "set palette model RGB functions\n4*x*(1-theta(x-0.25)), 0.5*theta(x-0.25)*(1-theta(x-0.5)), x"
splot x
pause -1 "Hit return to continue"

reset

