Reputation: 1529
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.
Upvotes: 3
Views: 696
Reputation: 6569
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')
Upvotes: 14