MATLAB subplot: how to have 1 colorbar for both images?

  • Context: MATLAB 
  • Thread starter Thread starter mikeph
  • Start date Start date
  • Tags Tags
    Images Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 9K views
mikeph
Messages
1,229
Reaction score
18
Title says it all. I have two matrices representing 2D surfaces, and I am using subplot to compare them in the same plat area, however, each has its own colorbar so comparison is not so easy to do by eye.

I'm pretty weak at figure handles, can someone give me a hint to do this? Thanks

Code:
subplot(1,2,1); h1 = pcolor(final); 
set(h1,'EdgeAlpha',0); colorbar
subplot(1,2,2); h2 = pcolor(initial);
set(h2,'EdgeAlpha',0); colorbar

Thanks
 
Physics news on Phys.org