Why do my subplots differ in size when each includes a y-axis label and a colorbar in MATLAB 7.0 (R14)?

2 views (last 30 days)
When I use the code:
for k=1:4
subplot(2,2,k)
colorbar
ylabel('my label')
end
The resulting subplots are not of the same size. Specifically, the subplots on the left are smaller than the subplots on the right.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This enhancement has been incorporated in Release 2007a (R2007a). For previous product releases, read below for any possible workarounds:
We have verified that there is a bug in MATLAB 7.0 (R14) when using subplots with y-axis labels and colorbars.
In MATLAB 7.0.1 (R14SP1), you can work around this issue by changing the order of the code so that the y-axis label is created before the colorbar.
For example, instead of this code,
for k=1:4
subplot(2,2,k)
colorbar
ylabel('my label')
end
Use this code:
for k=1:4
subplot(2,2,k)
ylabel('my label');
colorbar
end
If you are using MATLAB 7.0 (R14), there are no known workarounds.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!