Compute transfer function of Rainbow Colormap and display image using Rainbow Colormap
This submission merely replicates inbuilt functionality: the stated purpose of this submission is to
1) generate a rainbow colormap, and
2) plot the rainbow colormap's "transfer function".
The inbuilt JET function already offers a rainbow colormap, and colormap viewing is available using the function RGBPLOT, so in fact the main part of this submission can be replaced with the following twelve characters:
Just 12 characters that call inbuilt functions, instead of downloading three third-party functions from the internet... and RGBPLOT works with *all* colormaps too!
Then comes the question of why we need another rainbow colormap anyway, given the amount of discussion and research showing that rainbow colormaps are terrible at data representation. MATLAB has changed its default colormap to PARULA for exactly this reason:
And there are plenty of submissions on FEX that offer better colormaps than rainbow ones: