Borrar filtros
Borrar filtros

How to change default values and limits within a colormap

3 visualizaciones (últimos 30 días)
Jose abel De la Fuente
Jose abel De la Fuente el 27 de Oct. de 2016
Comentada: Image Analyst el 29 de Oct. de 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.

Respuestas (1)

Image Analyst
Image Analyst el 27 de Oct. de 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 comentarios
Jose abel De la Fuente
Jose abel De la Fuente el 28 de Oct. de 2016
Editada: Jose abel De la Fuente el 28 de Oct. de 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 el 29 de Oct. de 2016
Those points are probably NaNs.

Iniciar sesión para comentar.

Categorías

Más información sobre Blue en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by