MATLAB Answers

Merging multiple subplots into a mosaic

93 views (last 30 days)
Marin
Marin on 9 Jul 2012
I would like to make a subplot but in a way that there is not so much space between the plots. It should look like It should look something like this so that the axis labels and scales are only on the left and on the bottom and not on every plot separately and that all the plots are separated only by their axis.
I read the help on the subplot function but there is no mention of anything that would help me with this.
Thank you very much in advance!

  2 Comments

Thomas
Thomas on 9 Jul 2012
@Jan - link works for me.. Possibly our network connection issues cropping up again.. :)

Sign in to comment.

Accepted Answer

Jan
Jan on 9 Jul 2012
Edited: Jan on 9 Jul 2012

  2 Comments

Marin
Marin on 9 Jul 2012
I didn't know about this, thanks! I'm checking it now :)
Marin
Marin on 10 Jul 2012
Thanks, this third one seems best for the problem I described.

Sign in to comment.

More Answers (1)

Thomas
Thomas on 9 Jul 2012
Edited: Thomas on 9 Jul 2012
Something like this: just change the plot command with what you wan to plot..
% Create subplot
subplot1 = subplot(4,4,1,'XTickLabel',{'','','',''});
box(subplot1,'on');
hold(subplot1,'all')
% Create plot
plot(rand(4,1));
% Create subplot
subplot2 = subplot(4,4,2,'XTickLabel',{'','','',''},'YTickLabel',{'','',''});
box(subplot2,'on');
hold(subplot2,'all');
plot(rand(4,1));
% Create subplot
subplot3 = subplot(4,4,3,'XTickLabel',{'','','',''},'YTickLabel',{'','',''});
box(subplot3,'on');
hold(subplot3,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot4 = subplot(4,4,4,'XTickLabel',{'','','',''},'YTickLabel',{'','',''});
box(subplot4,'on');
hold(subplot4,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot5 = subplot(4,4,5,'XTickLabel',{'','','',''});
box(subplot5,'on');
hold(subplot5,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot6 = subplot(4,4,6,'XTickLabel',{'','','',''},'YTickLabel',{'','',''});
box(subplot6,'on');
hold(subplot6,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot7 = subplot(4,4,7,'XTickLabel',{'','','',''},'YTickLabel',{'','',''});
box(subplot7,'on');
hold(subplot7,'all');
% Create plot
plot(rand(4,1));
subplot8 = subplot(4,4,8,'XTickLabel',{'','','',''},'YTickLabel',{'','',''});
box(subplot8,'on');
hold(subplot8,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot9 = subplot(4,4,9,'XTickLabel',{'','','',''});
box(subplot9,'on');
hold(subplot9,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot10 = subplot(4,4,10,'XTickLabel',{'','','',''},'YTickLabel',{'','',''});
box(subplot10,'on');
hold(subplot10,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot11 = subplot(4,4,11,'XTickLabel',{'','','',''},'YTickLabel',{'','',''});
box(subplot11,'on');
hold(subplot11,'all');
% Create plot
% Create plot
plot(rand(4,1));
% Create subplot
subplot12 = subplot(4,4,12,'XTickLabel',{'','','',''},'YTickLabel',{'','',''});
box(subplot12,'on');
hold(subplot12,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot13 = subplot(4,4,13);
box(subplot13,'on');
hold(subplot13,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot14 = subplot(4,4,14,'YTickLabel',{'','',''});
box(subplot14,'on');
hold(subplot14,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot15 = subplot(4,4,15,'YTickLabel',{'','',''});
box(subplot15,'on');
hold(subplot15,'all');
% Create plot
plot(rand(4,1));
% Create subplot
subplot16 = subplot(4,4,16,'YTickLabel',{'','',''});
box(subplot16,'on');
hold(subplot16,'all');
% Create plot
plot(rand(4,1));

  2 Comments

Marin
Marin on 9 Jul 2012
This is very nice, thank you. Is there a way to decrease the amount of space between the plots?

Sign in to comment.

Sign in to answer this question.