I can't manage to stack plot 2 columns with the right graph size
2 ビュー (過去 30 日間)
古いコメントを表示
I´m trying to plot 4 graphs in 2 columns stacked vertically.
To do so I am trying the following subplot distribution. However when I do this my x axes (date/time) extends and the data looks very squashed up and I cannot manage to stack them. And ends up like in the image (does not include legend).
Anyone know how to make it look cleaner with the right axis size.
The point is to compare between graphs but the size seems to small.
Any help would be greatly apprecciated

subplot(2,2,1)
subplot(2,2,2)
subplot(2,2,3)
subplot(2,2,4)
0 件のコメント
採用された回答
Max Heimann
2022 年 3 月 4 日
You can alter the axis range with 'xlim'
figure('name','examplefigure')
% plot data
subplot(2,2,1)
plot(1:10,rand(1,10))
% set the x range
xlim([1 100])
% plot more data
subplot(2,2,2)
plot(1:10,rand(1,10))
subplot(2,2,3)
plot(1:10,rand(1,10))
subplot(2,2,4)
plot(1:10,rand(1,10))
% change the x range after the plotting.
subplot(2,2,2)
xlim([1 200])
0 件のコメント
その他の回答 (1 件)
Peter Perkins
2022 年 3 月 4 日
Inigo, I don't know what you data look like or how you have them stored, but I strongly recommend that you look at using a timetable and stackedplot:
tt = array2timetable(rand(5,6),"VariableNames",["A1" "A2" "A3" "B1" "B2" "B3"],"RowTimes",datetime(2022,3,1:5))
stackedplot(tt,{["A1" "A2" "A3"] ["B1" "B2" "B3"]})

参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!