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.

采纳的回答

KSSV
KSSV 2016-12-19
doc scatter
  1 个评论
Walter Roberson
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
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
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
hxen
hxen 2016-12-20
编辑:hxen 2016-12-20
Thanks guys. Will check this out. Guillaume, with the expection of rectangles instead of circles, yours is the closest to what I had in mind. I edited my original question to include now a schematic to what I had in mind to visually clarify.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Blue 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by