How to make spaces between graphs in a subplot

4 visualizaciones (últimos 30 días)
Linden
Linden el 23 de Abr. de 2014
Respondida: Gautam el 28 de Ag. de 2024
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

Respuestas (1)

Gautam
Gautam el 28 de Ag. de 2024
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

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by