make spaces in subplot

3 ビュー (過去 30 日間)
Linden
Linden 2014 年 4 月 25 日
コメント済み: Linden 2014 年 4 月 25 日
Hi,
I am using subplot to plot a number of graphs (see program below). The graphs in the subplot are too close to each other and the title of the graph (on top of each graph) is overlapped with the x axis of the above graph. Is there a way to increase the row space between the graphs? Many thanks in advance.
for i = 1:nvar
subplot(8,5,i);
plot(cell2mat(nonstnlist(2:end,i)));
set(gca,'XLim',[1,obs]);
title(nonstnlist(1,i),'interpreter','non');
saveas(gca,'nonstnlist.fig');
end

回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 4 月 25 日
You could try something like this,
magfactor = 4; %play with this.
sprows = 8 * magfactor - 1;
spcols = 5;
for i = 1 : nvar
sp_logical_row = 1 + floor((i - 1) ./ spcols);
sp_logical_col = i + mod(i - 1, spcols)
sp_group = (sp_logical_row - 1:sp_logical_row + magfactor - 1 - 1) * magfactor + sp_logical_col;
subplot(sprows, spcols, sp_group);
.... drawing commands here
end
If I have worked everything out correctly, then what this does is divides each row up into "magfactor" parts, and draws in the top (magfactor - 1) of them, leaving the bottom one empty to provide a buffer between rows.
  1 件のコメント
Linden
Linden 2014 年 4 月 25 日
Thanks very much Walter.

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by