Is 2d colormap supported by matlab?
조회 수: 1 (최근 30일)
이전 댓글 표시
Generally in matlab we use 1D gradient colormap as
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166919/image.png)
How do we use colormap like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166920/image.png)
댓글 수: 6
Stephen23
2017년 8월 28일
편집: Stephen23
2017년 8월 28일
@Ray Lee: as an aside, you really really should avoid using the awful JET/RAINBOW colormap. The reasons have been discussed in detail on the internet, and also here:
The new default colormap parula is a significant improvement, and you can also find other colormaps on FEX, ready for you to download:
채택된 답변
Image Analyst
2017년 8월 28일
Ray, if you have two parameters, air pressure and frequency, you can't use a colormap and you'll have to create an RGB image instead. You can get the color like this, assuming air pressure and frequency are the row and column of your "colormap" image:
for col = 1 : columns
for row = 1 : rows
thisColor = colormap2D(frequency(row, column), pressure(row, column), :) % A 1-by-3 vector
rgbImage(row, column, :) = thisColor;
end
end
So it has a pressure image and a frequency image. For exvery pixel, it gets the pressure and frequency and uses those as an index to get the desired color for that pixel, which it assigns to a new RGB image.
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!