How to change default values and limits within a colormap

3 次查看(过去 30 天)
Hi, How are you?.
I want to change the default values in a colormap, In order to plot a map of "diopter powers", like in this image:
However each value is related with a value (or a range of values). For example: if a "diopter power" has a value 39 to 40, the color has to be green. (It is a standard).
Someone could help to know, how I can choose the default values to each color in the colormap.
Thanks for your help.
Rewards.

回答(1 个)

Image Analyst
Image Analyst 2016-10-27
Looks kind of like jet upside down. Try this
imshow(grayImage, []);
myColorMap = flipud(jet(256));
% Top row black
myColorMap(end, :) = 0;
% Bottom row white
myColorMap(1, :) = 1;
colormap(myColorMap);
colorbar;
  2 个评论
Jose abel De la Fuente
编辑:Jose abel De la Fuente 2016-10-28
It is a grean idea!!
However I have tried to do it of different way (I know that is not the best idea), but It was the only way to solve my problem, like in this link:
This is my code:
supDiop = Dioptrica surface power; supAlt = surface height; pxEval = x axis; pyEval = y axis;
Each value of subAlt will be associated a color value which is related with the subDio.
surfc(pxEval,pyEval,(1./(supDiop>=1 & supDiop<=9)).*supAlt,'facecolor',[0/256,1/256,48/256]);
surfc(pxEval,pyEval,(1./(supDiop>=9 & supDiop<=14)).*supAlt,'facecolor', [0/256,0/256,82/256]);
surfc(pxEval,pyEval,(1./(supDiop>=14 & supDiop<19)).*supAlt,'facecolor', [0/256,0/256,115/256]);
surfc(pxEval,pyEval,(1./(supDiop>=19 & supDiop<24)).*supAlt,'facecolor', [0/256,0/256,163/256]);
surfc(pxEval,pyEval,(1./(supDiop>=24 & supDiop<29)).*supAlt,'facecolor', [0/256,0/256,198/256]);
surfc(pxEval,pyEval,(1./(supDiop>=29 & supDiop<35.5)).*supAlt,'facecolor', [0/256,0/256,254/256]);
Everything seemed fine, but I found other problem. when I coupled the surf one after the other (with hold on command) the images in the suft appear with omitted points like in this imagen:
can someone help me to know the cause?... and the solution.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Blue 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by