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

3 Ansichten (letzte 30 Tage)
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 Kommentare
José-Luis
José-Luis am 19 Dez. 2016
Could you show an example of what you want to achieve?
hxen
hxen am 20 Dez. 2016
Hi José-Luis. I now edited my original question to include a schematic of what I have in mind. Best.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 19 Dez. 2016
doc scatter
  1 Kommentar
Walter Roberson
Walter Roberson am 19 Dez. 2016
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Guillaume
Guillaume am 19 Dez. 2016
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 Kommentare
Guillaume
Guillaume am 20 Dez. 2016
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 am 20 Dez. 2016
Bearbeitet: hxen am 20 Dez. 2016
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.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by