필터 지우기
필터 지우기

How to change the colors in colormap function

조회 수: 2 (최근 30일)
Ray
Ray 2015년 12월 9일
댓글: Steven Lord 2015년 12월 9일
I have the expression below to plot the power with respect to x and y position. The colors vary based on the power level. I plotted the power using the expression below however the colors are gray, black etc. I need the colors to be red indicating high power, orange, blue, yellow, as the power goes from high to low.
cmap = 0:1/256:1;
cmap = [ cmap; cmap; cmap ]';
imagesc(data.power);
axis equal;
axis xy;
colormap( cmap );

채택된 답변

Image Analyst
Image Analyst 2015년 12월 9일
You can try one of the many built-in colormaps such as hsv, jet, parula, etc.
cmap = jet(256);
colormap(cmap);
colorbar;
  댓글 수: 1
Steven Lord
Steven Lord 2015년 12월 9일
And if none of the colormaps included in MATLAB do exactly what you want, you can start with the one that's closest and tweak it using COLORMAPEDITOR.

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

추가 답변 (1개)

Stephen23
Stephen23 2015년 12월 9일
편집: Stephen23 2015년 12월 9일
Identical R, G and B values gives gray, and this is what you are defining in your variable cmap.
If you want colors then why not simply read the colormap documentation and use one of the inbuilt colormaps. The documentation has working examples and figures showing all the inbuilt colormaps. Or pick any of the very attractive colormaps that are available on MATALB File Exchange:

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by