필터 지우기
필터 지우기

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

조회 수: 5 (최근 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 CenterFile Exchange에서 Blue에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by