MATLAB: Five plots arranged like on dice

diceplotsubplot

How can I arrange five plots in one figure so the plots would be on same positions like points on a dice? I dont want subplot (3,3,…) because of too much empty space. Thanks

Best Answer

Either
a) use subplot(2,3) and rearrange the two middle (make one invisible and move position of the second), or
b) draw them all individually where you want them.
Example for a) (which is what I think I'd do...)
h=zeros(6);
for i=1:6, h(i)=subplot(2,3,i); end % make the six, save handles
delete(h(2)) % wipe out the middle top one
p=get(h(5),'position'); % position of middle bottom
pt=get(h(1),'position'); % position of a upper
p(2)=(pt(2)+p(2))/2; % center of bottom for the two rows
set(h(5),'position',p) % move the middle to there...
h(2)=[]; % remove the nonexistent handle
Just remember that they're numbered sequentially now in position as
1 3 1 2
5 --> 4
4 6 3 5
You can always rearrange the handles in the h vector--swapping h(3) and h(4) would put them from L to R, T to B which probably as easy an ordering as there is, consistent w/ subplot itself.