How to fill different circles using a 'jet' colormap to represent data values
3 次查看(过去 30 天)
显示 更早的评论
I want to do several things to represent five temperature measurements for two conditions. First I want to represent the data measurements as circles organized along two columns and five rows. The columns would represent the different conditions and the rows the time when the measurements were taken for the two conditions. Second, I want the circles to be filled with the ‘jet’ colormap to represent the value of the measurements. The values would be normalized so the “hottest” color would be obviously the highest value. I am not sure if this is possible but would be surprised if MATLAB would not allow for this kind of representation.
Originally I tried using the fill function but it appears to only let you specify an RGB color and no colormap. I gladly appreciate any help or suggestions.
I've attached here to this edited question now a schematic representation of the output I would like to obtain to better clarify what I have in mind. Again, I would like to have a color map bar to the side to reflect the color values used to fill the circles.
Once again thanks to all for the feedback.
2 个评论
采纳的回答
KSSV
2016-12-19
doc scatter
1 个评论
Walter Roberson
2016-12-19
scatter() is the approach I would take. You can set the size to something large such as 10000, and you can use 'filled', and you can set the color field to your data value; if you use a color vector then it will be interpolated into the color map.
更多回答(1 个)
Guillaume
2016-12-19
Same as José-Luis, I'm not too sure what exactly you want to achieve. However, if whichever function you want to use only accept RGB values you can always grab these off the colour map:
measures = rand(5, 2);
cmap = jet; %for default of 64 colours, or jet(n) to specify the number of colours
%normalise measures to range of colours
mapindex = round((measures - min(measures(:))) / (max(measures(:)) - min(measures(:))) * 63) + 1;
[y, x] = ndgrid(1:size(measures, 1), 1:size(measures, 2));
%creating rectangles instead of circles as it's just a demo:
figure; hold on;
arrayfun(@(x,y,m,ci) fill(x + [m m -m -m], y + [m -m -m m], cmap(ci, :)), x, y, measures/max(measures(:))/2, mapindex);
However, I would recommend against using jet. It's not a very good colour map. The newer parula is better.
3 个评论
Guillaume
2016-12-20
Good little demo. I think it's missing the plot of the luminance of the colour map, which really demonstrates how bad jet is.
In a good colour map, the luminance is monotonously increasing or decreasing
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Blue 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!