User defined colorbars in a plot
5 views (last 30 days)
Show older comments
Hello,
I need a colourbar as shown in the attachment.
Color changes
from light red to red for 1 to 10;
from red to yellow for >10 to 100;
yellow to light green than light blue for 100 to 1000
and ends with dark blue for 2048.
How to achieve this predefined colorbar? Any suitable cmap that can give similar colorbar.
Answers (2)
Walter Roberson
on 4 Feb 2020
Note that the positions needed there are in the range 0 to 1, so you would need to divide your values by 2048 for this purpose. However, that will not matter for later as you can caxis([1 2048]); colormap(TheCustomMap)
Caution: sufficiently old MS WIndows are restricted to 256 colors in a colormap, but you need 1024 positions (you do not need 2048 positions because each of your bins can be data width 2.) If you could fudge the boundaries to 16 and 128 then you could reduce the number of colormap entries needed.
0 Comments
See Also
Categories
Find more on Color and Styling in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!