Thursday, 3 October 2013

How to have more columns and rows, with different sizes, in SUBPLOT?


%Subplot with different sizes and shapes
figure;
subplot(2,1,1);
surf(magic(20));

subplot(2,3,4);
surf(magic(10));

%Increased size in x-direction
subplot(2,3,5:6);
surf(magic(10));

%Increased size in y-direction
figure;
subplot(10,2,1:6);
plot(sin(2*pi*5*(0:0.001:1)));

subplot(10,2,7:20);
surf(magic(10));

Note: The key idea is, first define the number of rows(R) and number of columns(C), for example subplot(R,C,xx:yy) and then play with the third entry (xx:yy) to define the sizes.

You can also control the 'position and size' of the subplot using:
subplot('position',[0 0 1 1]);

%This is bit involved as it demands you to know the co-ordinates and also the size

No comments:

Post a Comment