How to make spaces between graphs in a subplot
조회 수: 4 (최근 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 :
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!