how to set color range for color in color bar
6 views (last 30 days)
Show older comments
Muhammad Usman Saleem
on 6 Aug 2015
Commented: Walter Roberson
on 8 Aug 2015
In the following color map, i want to set
<0 values set as variation in brightness in deepskyblue 0-79 interval as variation in light green
79-157 interval as variation (you are right variation in brightness) in yellow
above 157 values as variation in brightness from light red to dark red.
I want to show the value above 157 are dark in red color. This is my upper bound.
Also guide me what kind of interpolation technique matlab use to generate raster surface from point data?
Please help??
0 Comments
Accepted Answer
Walter Roberson
on 6 Aug 2015
Using the color definitions from http://www.rapidtables.com/web/color/blue-color.htm and the color names that you provided:
total_len = 160; %your description did not give an upper bound
part1_len = 79 - 0 + 1;
part2_len = 156 - 80 + 1;
part3_len = total_len - 157 + 1;
%"variations in blue"... ummm, different brightnesses of blue?
map_part1 = [zeros(part1_len,1), zeros(part1_len,1), linspace(128,255,part1_len).'];
%purple = (128,0,128), yellow = (255,255,0)
map_part2 = [linspace(128, 1, part2_len).', linspace(0, 128, part2_len).', linspace(128, 0, part2_len).'];
%red = (255,0,0), dark red = (139, 0, 0)
map_part3 = [linspace(255, 139, part3_len).', zeros(part3_len,1), zeros(part3_len,1)];
%colormaps need to be in the range 0 to 1 so divide by 255
total_map = [map_part1; map_part2; map_part3] ./ 255;
colormap(total_map);
I rather expect that you are going to be disappointed with your color choices.
12 Comments
Walter Roberson
on 8 Aug 2015
You need to download and install http://www.mathworks.com/matlabcentral/fileexchange/28943-color-palette-tables---cpt--for-matlab
More Answers (0)
See Also
Categories
Find more on Colormaps 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!