Plotting three charts in one figure

matlab

Solution

You can use `subaxis`. I wrote a sample code below:

x = 0:0.1:10;
spacing = 0.0;
subaxis(3,1,1,'Spacing',spacing);
plot(x,rand(size(x)),'k')
legend('D','Location','NorthWest')
ylim([-0.2 1])
set(gca, 'box','off')
set(gca,'XAxisLocation','top')

subaxis(2,'Spacing',spacing);
plot(x,rand(size(x)),'r')
legend('C','Location','NorthWest')
ylim([-0.2 1])
set(gca,'xtick',[],'box','off','xcolor','w')

subaxis(3,'Spacing',spacing);
plot(x,rand(size(x)),'b')
legend('B','Location','NorthWest')
set(gca, 'box','off')

Problem

How can I plot a figure like this: My question is not about "subplot" function. I have one "x" array for x axis and three "y" arrays for y axis. I want to plot all (x,y) charts in a figure like above.

Original source