Colorbar mapping colors incorrectly on complex subplot image

2 views (last 30 days)
I have code that says:
figure;
color hsv;
subplot(511);
hold all;
heatmaptext(data1, 'COLORBAR',false); %data is a 2D matrix
%and so on for the next 4 subplots...
%then
axes('Position', [0.05 0.05 0.9 0.9], 'Visible', 'off');
c = colorbar;
caxis([myMin, myMax]); %just the max and min of all the data used
where heatmaptext.m is the "pick of the week" submission on the file exchange.
Its a great image HOWEVER, when I look closely I see that the colors in the cells do not align to the colors shown on the color bar (at all). eg for a colorbar with range -1 -> +1, bright red according to the colorbar is +1, whereas my red cells might have values of 0.5 (i.e. the cells should be green).
Hence something has gone wrong with the mapping.
I am pretty sure the issue is not with the heatmaptext.m code but with my attempt to put one universal colorbar on a subplot image.
Any ideas? thanks

Answers (0)

Community Treasure Hunt

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

Start Hunting!