フィルターのクリア

how could I use subplot function to squeeze 12 existing graphs into 2 pages of 2x3

2 ビュー (過去 30 日間)
Ed Chan
Ed Chan 2016 年 3 月 13 日
編集済み: MHN 2016 年 3 月 13 日
I plotted 12 hourly velocity profiles using the following codes
if true
%
h = 2.5:2:40.5;
for a = date1126+12:date1126+23; % second tidal cycle of the day is selected by observing mag_ts
if and(a>=date1126+16,a<=date1126+22);% flood tide
plot(East_hrAve(:,a),h)
set(gca,'XTick',linspace(0,1.6,9)); % set x min and max and steps
set(gca,'XTickLabel',[0:0.2:1.6]); % set labels
xlim([0 1.6]);
else % ebb tide
plot(East_hrAve(:,a),h)
set(gca,'XTick',linspace(-1.6,0,9)); % set x min and max and steps
set(gca,'XTickLabel',[-1.6:0.2:0]); % set labels
xlim([-1.6 0]);
end
xlabel('Current East Velocity (ms^{-1})');
ylabel('Height above seabed (m)');
end
If the codes above are too complicated, I have simplified them to the ones below:
h = 2.5:2:40.5;
for a = date1204:date1204+12-1;% 1st cycle of the day is selected by observing mag_ts
figure;
plot(East_hrAve(:,a),h);
set(gca,'XTick',linspace(-1,1,11)); % set x min and max and steps
set(gca,'XTickLabel',-1:0.2:1); % set labels
xlim([-1 1]);
xlabel('Current East Velocity (ms^{-1})')
ylabel('Height above seabed (m)')
end
end
I would like to subplot every 6 graphs into a page of 2x3 but am not sure how to do it using subplot(2,3,__). There are 12 graphs above. You may alter my codes to create subplot or you may add a few lines after my codes to rearrange the existing velocity profiles into subplot. Many thanks.

採用された回答

MHN
MHN 2016 年 3 月 13 日
編集済み: MHN 2016 年 3 月 13 日
h = 2.5:2:40.5;
i=1; % ADD THIS LINE
figure; % ADD THIS LINE
for a = date1204:date1204+12-1;% 1st cycle of the day is selected by observing mag_ts
if mod(i,7)==0 % ADD THIS LINE
i=1; % ADD THIS LINE
figure; % ADD THIS LINE
end % ADD THIS LINE
subplot(3,2,i) % ADD THIS LINE
i = i+1; % ADD THIS LINE
plot(East_hrAve(:,a),h);
set(gca,'XTick',linspace(-1,1,11)); % set x min and max and steps
set(gca,'XTickLabel',-1:0.2:1); % set labels
xlim([-1 1]);
xlabel('Current East Velocity (ms^{-1})')
ylabel('Height above seabed (m)')
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by