Mismatching axis size of subplots due to colorbar
Alec Jacobson
April 21, 2013
When using subplots and axis commands the colorbar command in matlab can mess up alignments:
subplot(1,2,1);
plot([0 100],[0 100]);
axis equal;
subplot(1,2,2);
plot([0 100],[0 100]);
axis equal;
colorbar
Produces:
A quick fix to get the fix axis to be the same size as the second is to use:
set(colorbar,'Visible','off');
So that
subplot(1,2,1);
plot([0 100],[0 100]);
axis equal;
set(colorbar,'Visible','off');
subplot(1,2,2);
plot([0 100],[0 100]);
axis equal;
colorbar
Produces: