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

  • Thread starter Thread starter mikeph
  • Start date Start date
  • Tags Tags
    Images Matlab
Click For Summary
To display two 2D surface matrices in MATLAB subplots with a single colorbar, scale both images uniformly and disable one of the colorbars. The user initially creates subplots with individual colorbars, making visual comparison difficult. By using figure handles and adjusting the colorbar settings, a single colorbar can effectively represent both images. This approach simplifies the comparison process and enhances clarity in visual analysis. Implementing these adjustments will improve the overall presentation of the data.
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
scale each image the same and then turn off one of the colorbars, they are not necessary for each subplot
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K