Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: ColorMap + Noisy Double Gaussian + Histogram
Replies: 1   Last Post: Sep 16, 2013 11:48 AM

 Messages: [ Previous | Next ]
 Steven Lord Posts: 18,038 Registered: 12/7/04
Re: ColorMap + Noisy Double Gaussian + Histogram
Posted: Sep 16, 2013 11:48 AM

"Michael " <mabowles@syr.edu> wrote in message
news:l11ti1\$871\$1@newscl01ah.mathworks.com...
> 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!

*snip*

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.

--
Steve Lord
slord@mathworks.com