Color scalebar issues when adding a scatter in top of an (RGB) image

2 Ansichten (letzte 30 Tage)
Merijn
Merijn am 9 Dez. 2016
Bearbeitet: Merijn am 9 Dez. 2016
Hi All,
I have a sequence of images on top of which I want to draw colored scatter marks. I made the color of each mark dependent on a measured value at that location. Everything draws fine, but the color scalebar does not scale with the marks from the scatter. On the other hand, if I draw the scatter separately without the RGB picture behind it the scaling is suddenly good, so I'm guessing that in my case the colorbar is automatically set to scale to some values in the RGB image. I want to be able to set the object or values the color bar scales to. I found the Limits property of the colorbar, but when I use that, only the values are changed, but the color is not scaled. What am I missing here?
for i=1 : nfiles
close all
figure()
h=imshow(cell2mat(imagesRGB(i)));
hold on
scatter(xnew/1.4,ynew/1.4,100,v(i,:),'filled');
caxis([min(min(v)),max(max(v))]);
c=colorbar;
c.Limits=[min(min(v)) max(max(v))];
colormap('jet');
c.Label.String = 'Local velocity [m/s]';
hold off
saveas(h,imagefiles(i).name)
end
As you can see the resulting colorbar scales, but the colors do not scale. If I let out the c.Limits=[min(min(v)) max(max(v))];, the colorbar autimatically scales from 0 to 62, which is not representative for my data.
I'm using Matlab R2014b.

Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by