![cmap.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/214803/cmap.png)
Array of +1s and -1s: Want Pink and Blue for imagesc
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Aylin
2019-4-18
% Generate some sample data.
data = 2 * randi([0 1], 10, 10) - 1;
% Define the color map. Normalize 0-255 RGB values to 0-1 intensities.
map = [255, 20, 147;
0,191, 255] / 255;
% Plot data and set the new colormap on the current figure.
imagesc(data)
colormap(map)
This generates the following image:
![cmap.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/214803/cmap.png)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Orange 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!