How to plot partial results of a for-loop in one figure and create different figures for other results?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
José-Luis
2017-7-4
7 个评论
José-Luis
2017-7-4
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!