# How to plot too many graph in a figure?

8 visualizaciones (últimos 30 días)
Arnab Pal el 6 de En. de 2021
I am trying to plot 18 graph in a figure in 3 X 6 manner. But they are comming as too small. I want to increase length of the canvas but unable to do that properly. Please give me solutions.
I have prepared the code in this way:
figure(1)
subplot(6,3,1)
plot(0:24, DE(1,:),':o', 'MarkerSize', 4, 'MarkerFaceColor', [0.75 0 0.75],'color',[0.75 0 0.75],'LineWidth',2),legend('BES1 DE', 'Location','southeast')
set(gca,'FontSize',18)
xlabel('Hour')
ylabel('Stored Energy (kWh)')
xlim([0 24])
% ylim([2085 2105])
set(gca,'XTick',(0:6:24));
subplot(6,3,2)
plot(0:24, DE(2,:),':o', 'MarkerSize', 4, 'MarkerFaceColor',[0 0.5 0],'color',[0 0.5 0],'LineWidth',2),legend('BES2 DE', 'Location','southeast')
set(gca,'FontSize',18)
xlabel('Hour')
ylabel('Stored Energy (kWh)')
xlim([0 24])
% ylim([1000 3500])
set(gca,'XTick',(0:6:24));
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (2)

Cris LaPierre el 6 de En. de 2021
It looks like all your plots share the same x axis values. Have you considered using stackedplot?
##### 3 comentariosMostrar 1 comentario más antiguoOcultar 1 comentario más antiguo
Cris LaPierre el 6 de En. de 2021
To make a bigger figure window, use the figure function and set the position properties. Here is an example of how you could make the figure window full screen.
figure('Units','normalized','Position',[0,0,1,1])
Adam Danz el 6 de En. de 2021
The problem I see in the figure is the tiny axes and the large amount of space that labels and legends consume. I don't see a problem with the figure size.
stackedplot would greatly reduce that problem, especially if you have 3 stacked plots on the same figure.

Iniciar sesión para comentar.

Adam Danz el 6 de En. de 2021
• Does each line really need its own axis? Why not plot all lines together on 1 axis and just different colors or marker symbols to indicate their meaning, along with a legend?
• Remove the legends; you don't need legends if there's only 1 line per axis.
• You also don't need xlabel and ylabel for each plot. Instead, only label the x axis on the bottom axes and 1 y axis for each column of axes.
• Instead of subplot() use TiledLayout and set TileSpacing and/or Padding to 'compact' or 'none'.
• Lastly, try out stackedplot() since all of your x-axes are the same scale. See how to add more than 1 stacked plot per figure and how to link the x-axes.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by