How to fill different circles using a 'jet' colormap to represent data values

3 ビュー (過去 30 日間)
hxen
hxen 2016 年 12 月 19 日
編集済み: hxen 2016 年 12 月 20 日
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 件のコメント
José-Luis
José-Luis 2016 年 12 月 19 日
Could you show an example of what you want to achieve?
hxen
hxen 2016 年 12 月 20 日
Hi José-Luis. I now edited my original question to include a schematic of what I have in mind. Best.

サインインしてコメントする。

採用された回答

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 Center および File ExchangeBlue についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by