A simple, quick and dirty approach (still to be tuned) would be the following if you just need a rough impression of the color. Make sure that set samples
is set high enough such that you have enough impulses
and don't get white (background) lines.
If you need this spectrum in another graph create an inset with multiplot
by adjusting origin
and size
. Check this in gnuplot with help multiplot
, help origin
and help size
However, if you need more precise color representation, check the links at the link you gave.
Code:
### visible spectrum ("quick and dirty")
reset session
set palette defined (380 "black", 400 "dark-violet", 440 "blue", 490 '#00b0c0', 530 "green", 560 "yellow", 620 "red", 780 "black")
set samples 1000
unset colorbox
plot [380:780] '+' u 1:(1):1 w impulse lc palette notitle
### end of code
Result:

Addition:
Maybe something like this:
Code:
### visible spectrum ("quick and dirty")
# inserted into another plot
reset session
set palette defined (380 "black", 400 "dark-violet", 440 "blue", 490 '#00b0c0', 530 "green", 560 "yellow", 620 "red", 780 "black")
set samples 1000
unset colorbox
set multiplot
plot cos(x)+0.2*x
set origin 0.05,0.75
set size 0.45, 0.2
unset tics
plot [380:780] '+' u 1:(1):1 w impulse lc palette lw 1 notitle
unset multiplot
### end of code
Result:

Another variation:
Code:
### visible spectrum ("quick and dirty")
# below curve
reset session
set palette defined (380 "black", 400 "dark-violet", 440 "blue", 490 '#00b0c0', 530 "green", 560 "yellow", 620 "red", 780 "black")
set samples 1000
unset colorbox
f(x) = sin((x-380)/25)*cos((x-580)/10) + 2
plot [380:780] '+' u 1:(f(x)):1 w impulse lc palette notitle, \
f(x) w l lw 2 lc rgb "black" notitle
### end of code
Result:
