Discussion:
Gnuplot Visible Light Spectrum Palette
(too old to reply)
mattxmal
2005-02-09 10:50:00 UTC
Permalink
Does anyone have handy a palette (for use with pm3d) that approximates
the visible light spectrum? Doing it by trial and error doesn't
produce the results I would like.

Thanks,

Matt
Theo Hopman
2005-02-09 14:52:45 UTC
Permalink
Post by mattxmal
Does anyone have handy a palette (for use with pm3d) that
approximates
Post by mattxmal
the visible light spectrum? Doing it by trial and error doesn't
produce the results I would like.
See
http://lists.runrev.com/pipermail/use-revolution/2003-August/021026.html
for an approximation formula. It'll have to be converted into gnuplot,
but it's a start.


THeo
Namio MATUDA
2005-02-28 07:09:30 UTC
Permalink
Post by mattxmal
Post by mattxmal
Does anyone have handy a palette (for use with pm3d) that
approximates
Post by mattxmal
the visible light spectrum? Doing it by trial and error doesn't
produce the results I would like.
See
http://lists.runrev.com/pipermail/use-revolution/2003-August/021026.html
for an approximation formula. It'll have to be converted into gnuplot,
but it's a start.
THeo
Here is a sample gnuplot's script using pm3d palette functions.

****************************************************************
set pm3d map
set palette color
unset ztics; unset ytics
set samples 200
set isosamples 2
lmax = 780; lmin = 380
k=lmax-lmin
set xrange [lmin:lmax]
set cbrange [lmin:lmax]
set xtics 100
r(x)=x<440?-(x-440)/(440-380):x<510?0:x<580?(x-510)/(580-510):x<=780?1:
0
g(x)=x<440?0:x<490?(x-440)/(490-440):x<580?1:x<645?-(x-645)/(645-580):0
b(x)=x<490?1:x<510?-(x-510)/(510-490):0
f(x)=x<420?0.3+0.7*(x-380)/(420-380):x<700?1:0.3+0.7*(780-x)/(780-700)
set palette functions
f(k*gray+lmin)*r(k*gray+lmin),g(k*gray+lmin),f(k*gray+lmin)*b(k*gray+lmin)
splot x
pause -1

set autoscale y
set ytics
set yrange [-0.1:1.1]
unset pm3d
k=1;lmin=0
plot f(x)*r(x) lt 1 lw 2, g(x) lt 2 lw 2, f(x)*b(x) lt 3 lw 2
pause -1
********************************************************************

I must wrote down without single space character in the long commend
lines, because unexpected line folding occures.
Have a fun!

Namio.

Loading...