필터 지우기
필터 지우기

How to change default values and limits within a colormap

조회 수: 3 (최근 30일)
Jose abel De la Fuente
Jose abel De la Fuente 2016년 10월 27일
댓글: Image Analyst 2016년 10월 29일
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일
편집: 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.
Image Analyst
Image Analyst 2016년 10월 29일
Those points are probably NaNs.

댓글을 달려면 로그인하십시오.

카테고리

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