How to obtain a cutsomized colorbar at certain color value range?
Show older comments
Hi,
I would like to obtain a customizd colorbar that has a range from 0-24.
I would like to paint black color for the points falling between 0-6 in colorscale,
paint red for the points falling between 6-18 in colorscale,
again paint black for the points falling between 18-24 in colorscale.
Any suggestions would be greatly appriciated.
scatter(X_axis_val,Y_axis_val,20,Z_axis_val)
MyColBar = [0 0 0; 1 0 0; 0 0 0];
colormap(MyColBar);
caxis([0 24]); colorbar;
The data is as attached below.
Thank you in advance.
Accepted Answer
More Answers (1)
Walter Roberson
on 20 Feb 2023
MyColBar = [0 0 0; 1 0 0; 1 0 0; 0 0 0];
You cannot have color sections of different widths, but you can duplicate colors.
1 Comment
Categories
Find more on Orange 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!