"Michael " <email@example.com> wrote in message news:firstname.lastname@example.org... > Hello everyone, > > I have a possibly interesting query! I think my question may be confusing > but keep in mind this isn't a math question or an assignment.. I just want > to play around a =nd make a pretty image with your help! > > I'd like to build a picture of a two gaussians added together (but the > peaks far enough away to distinguish). > > I'd like to histogram the results :) and then apply something like a > different color to every bin (in a rainbow-like order!) ROYGBIV or some > cyclic version i.e. red ain't gotta be the first color. But if possible > I'd like ot have the ability to cycle the colors (as in ROYGBIV or IVROYGB > GBIVROY) in some way would be neat but it may be too difficult or not > worth anyone's time!
surf(peaks); colorbar for k = 1:length(colormap) M = colormap; colormap(M([2:end, 1], :)) % move one row to the other end of the colormap pause(0.1) end
Colormaps in MATLAB are just matrices, and can be manipulated like any other matrix. You may be interested in the COLORMAPEDITOR, which will let you tweak to choose exactly your "rainbow" colormap, since I don't think such a colormap is included with MATLAB.