I got this to work with the previous code, however I couldn’t get it to work with the code you posted. You will need to make the appropriate adjustments to do that.
The change is to add these two lines in each looop:
PosVec = Ax.Position;
Ax.Position = PosVec+[0 -0.005 0 0.005];
and after both loops:
f1.Position = f1.Position+[0 -300 0 300];
That should get you started.
The (Revised) Code —
conRR = [(0:10).' rand(11,5)*80];
b9RR = [(0:10).' rand(11,5)*80];
suplotTitle = {'0.4mA', '0.6mA', '0.8mA', '1.2mA', '1.6mA'};
f1=figure
for ii=1:5
Ax = subplot(5,2,2*ii-1);
b1 = bar(conRR(2:end,1), conRR(2:end,ii+1));
b1.FaceColor = '#D95319';
b1.EdgeColor = 'none';
xticks(1:1:16);
ylim([0 80]);
title(suplotTitle{ii})
PosVec = Ax.Position;
Ax.Position = PosVec+[0 -0.005 0 0.005];
end
for ii=1:5
Ax = subplot(5,2,2*ii);
b2 = bar(b9RR(2:end,1), b9RR(2:end,ii+1));
b2.FaceColor = '#0072BD';
b2.EdgeColor = 'none';
xticks(1:1:16);
ylim([0 80]);
title(suplotTitle{ii})
PosVec = Ax.Position;
Ax.Position = PosVec+[0 -0.005 0 0.005];
end
f1.Position = f1.Position+[0 -300 0 300];
The Plots —
Original:
This code:
Best Answer