which colormap I can chose to draw these figures?
Show older comments
Which colormap I can use to plot following figures? or any unction or code to create following figures by using imagesc?



Accepted Answer
More Answers (1)
Hard to say without knowing the data values but it looks like a ramp of red and an inverse ramp of blue with white in the middle. Maybe try something like
numColors = 256;
triangle = [linspace(0, 1, numColors/2)'; linspace(1, 0, numColors/2)'];
r = triangle;
g = triangle;
b = triangle;
r(numColors/2 + 1 : end) = 1;
b(1 : numColors/2) = 1;
plot(r, 'r-', 'LineWidth', 3);
hold on;
plot(g, 'g-', 'LineWidth', 3);
plot(b, 'b-', 'LineWidth', 3);
title("Custom Color Map")
grid on;
% Make the colormap
cmap = [r, g, b];
1 Comment
Ahmed
on 7 Feb 2024
Edited: Walter Roberson
on 7 Feb 2024
Categories
Find more on Blue in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


