Building three diagrams in one drawing

How can I build such a figure: enter image description here

My question is not about the subplot function. I have one array "x" for the x axis and three "y" arrays for the y axis. I want to build all (x, y) diagrams in a figure, as shown above.

+3
source share
1 answer

You can use subaxis. I wrote an example 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')

enter image description here

+14
source

All Articles