how could I use subplot function to squeeze 12 existing graphs into 2 pages of 2x3
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!