Rank: 307918 based on 0 downloads (last 30 days) and 0 file submitted

Nicolas Weiss


Personal Profile:


Watch this Author's files


Comments and Ratings by Nicolas Weiss
Updated File Comments Rating
07 Dec 2011 freezeColors / unfreezeColors Use multiple colormaps per figure! Version 2, now works for many types of objects, not only images. Author: John Iversen

Nice script, but the fact that you cannot export eps files is a big downside. I found a workaround to this with the info posted here: http://www.mathworks.nl/support/tech-notes/1200/1215.html

Specifically, I wanted to plot a contour in the same axis as a gray scale image. This is an example of how to do this:

%Define the colormap

data = 255.*rand(100);
data2 = peaks(100);

h(1) = imagesc(data);
hold on
[C,h(2)] = contour(data2);
hold off

m = 64; % 64-elements is each colormap

cmin = min(data(:));
cmax = max(data(:));
C1 = min(m,round((m-1)*(data-cmin)/(cmax-cmin))+1);

cmin = min(data2(:));
cmax = max(data2(:));
C2 = min(m,round((m-1)*(data2-cmin)/(cmax-cmin))+1);
C2 = m+C2;


caxis([min(C1(:)) max(C2(:))])

%Fix the color bar so that it only dispalys the colors of the contour
colorbar('YLim',[65,128],'YTickLabel',[10 20 30 40 50 60])

Contact us