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!