How to plot partial results of a for-loop in one figure and create different figures for other results?
1 view (last 30 days)
Show older comments
I have a for loop, which reads in and evaluates the run-off values for various years. There are several time series for each year. So I have an ensemble of time series per year. Now I want to create a figure for each year, in which the respective ensemble is presented.
The following code section shows the plot function for the year 2014 as an example:
sdatelim=[datenum(2014,05,01) datenum(2014,10,01)];
dt = 1/24;
sdate2014 = sdatelim(1):dt:sdatelim(2);
figure('Position',[200 100 900 900],'PaperPositionMode','auto','Color','w');
a(1) = axes;
set(a(1),'Position',[0.09 0.09 0.80 0.80],'fontsize',13)
hold on;
plot(sdate2014(1:3672),Qs2014,'.'); hold on;
% the next figure for the subsequent year
... figure(...); hold on;
a() = axes ...
plot (sdate2015(1:3672),Qs2015); hold on;
Regardless of whether I add the figure command before the loop or add the hold on, always a separate figure is opened.
Now my questions are:
- How can I create multiple figures with the corresponding ensemble (that means e.g. all time series for the year 2014 in one figure)?
- How can I change the line color within a figure for a few thousand ensemble members?
0 Comments
Accepted Answer
José-Luis
on 4 Jul 2017
7 Comments
José-Luis
on 4 Jul 2017
I don't get it. You are not using the ii index inside the loop. Is Qs2014 a 2D array?
If so:
subplot(2,1,1)
plot(sdate2014(1:3672),Qs2014,'Color',rand(1,3));
subplot(2,1,2);
plot(sdate2015(1:3672),Qs2015,'Color',rand(1,3));
Have you tried reading the documentation? It's pretty good --- most of the time.
More Answers (0)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!