Matlab subplot command not displaying all subplots
Show older comments
I am trying to create a custom layout for 30 subplots. Since Matlab's standard settings go a bit overkill on the padding between each plot, I am trying to custom position them. The code is this:
bd=2*0.01428571; % give a total border of 0.2 in the horizontal
ww=0.8/6; % leaves a total of 0.8 to create subplots: 6 in horizontal
hh=0.8/5; % 5 in vertical
figure
for i=1:30 % total of 30 subplots
ln=ceil(i/6); % determines the line we are in (line 1 goes at the top)
cl=i-(ln-1)*6; % determines the column we are in
subplot(5,6,i,'position',[cl*bd+(cl-1)*ww (6-ln)*bd+(5-ln)*hh ww hh])
end
The code executes without problem but I end up with only about 15 subplot, the rest is empty. I have gone through it step by step and turns up that when placing certain subplots others get removed! The result is attached.
I tried it several times, changed the value for bd cause I thought it was caused by some overlap but to no avail. Is there some intrinsic limit as to how many subplots you can have or is this some (rather significant) bug in Matlab? I am using R2014b. Thanks.
Answers (1)
Categories
Find more on Subplots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!