![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1761154/image.png)
How to make spaces between graphs in a subplot
3 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
Gautam
2024 年 8 月 28 日
Hello Linden,
I understand that you want to adjust the spacing between the individual graphs of a subplot. You can achieve this by setting the position of the graphs on the “Position” property of the axis handle of the graph.
The code below sets the position of the last graph in the subplot. In this, I have plotted a contour plot of the data received by the “peaks” function for all the plots
Z = peaks(100);
for i = 1:9
s = subplot(3,3,i);
contour3(Z);
title("Contours",'interpreter','non');
end
s.Position = [0.75 0.0500 0.2109 0.2157];
This gives the output as :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1761154/image.png)
Hope this helps
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Printing and Saving についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!