How can I use same color range on subimages?
Ältere Kommentare anzeigen
Hi, I want, that my all subimages have the same colour range. I´m using caxis command but it doesn´t work. Can you help me? I'm lost. (sorry for my english)
bottom = min(min(min(mmin1,mmin2),mmin3),mmin4);
top = max(max(max(mmax1,mmax2),mmax3),mmax4);
subplot(3,2,1+2)
subimage(imresize(imag,20),colormap(jet));
axis off
caxis manual
caxis([bottom top]);
colorbar;
subplot(3,2,2+2)
subimage(imresize(imag,20),colormap(jet)),
axis off
caxis manual
caxis([bottom,top]);
colorbar;
2 Kommentare
Adam
am 5 Mär. 2015
That seems like generally what you should be doing though I always use explicit axes handles for any plotting-related functions to ensure it is being applied to the correct axes.
I can't run your code though as I don't have all the variables defined that you have.
Ludmila Nemsilajova
am 6 Mär. 2015
Akzeptierte Antwort
Weitere Antworten (1)
Adam
am 6 Mär. 2015
0 Stimmen
Ok, now that I have looked at the help page for subimage as I have never used it, it works by converting your image to true colour for display by applying the colourmap you give. That means it will be unaffected by changes to the 'CLim' property (e.g. via caxis).
If you wish to change the colour scaling you will have to do it on the image (or the colourmap) before you call subimage because once it converts to true RGB the colourmap becomes irrelevant.
It is confusing that Matlab allows you to put a colourbar on the screen even for images that are unaffected by it, but that is just the way it works.
Kategorien
Mehr zu Color and Styling finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
