How to plot too many graph in a figure?
조회 수: 7 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Cris LaPierre
2021년 1월 6일
댓글 수: 3
Cris LaPierre
2021년 1월 6일
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
2021년 1월 6일
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.
Adam Danz
2021년 1월 6일
편집: Adam Danz
2021년 1월 6일
- 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
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!