We have a heatmap we want to display. The numbers that will make up the values being displayed are unknown (except that they will be positive integers). The range of numbers
A little late, but I was trying to do the same and found I can modify HSV to RGB to get a similar result. It's similar to the wavelength approach but by passes the need to convert to wavelength first. Just substitute H with your value (assuming a value between 0 and 1), and fix S and V to 1. I found the HSVtoRGB example here to be very helpful:
http://www.cs.rit.edu/~ncs/color/t_convert.html
However, I had to change the lines
h /= 60;
i = floor ( h );
to
h *= 5;
i = (int) h;
to get an output that goes through the whole spectrum.
Additional resource: http://www.easyrgb.com/index.php?X=MATH&H=21#text21