Effacer les filtres
Effacer les filtres

How to change default values and limits within a colormap

3 vues (au cours des 30 derniers jours)
Jose abel De la Fuente
Jose abel De la Fuente le 27 Oct 2016
Commenté : Image Analyst le 29 Oct 2016
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.

Réponses (1)

Image Analyst
Image Analyst le 27 Oct 2016
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 commentaires
Jose abel De la Fuente
Jose abel De la Fuente le 28 Oct 2016
Modifié(e) : Jose abel De la Fuente le 28 Oct 2016
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 le 29 Oct 2016
Those points are probably NaNs.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Blue dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by