how to plot cdfplot with different line style?

조회 수: 81 (최근 30일)
Hydro
Hydro 2017년 3월 26일
댓글: Ritayan Biswas 2021년 7월 6일
Hi all,
I am trying to compare observed streamflow versus simulated (coming from two models) data for the calibration and validation period. I need to assign a different line style and color to each set of data but should be consistent in both subplots.
I have written down this code but can't get the line style out of it (here is some random data)
Xobc=randn(1000,1);X1=randn(1000,1)+10; X2=randn(1000,1)*5;
Xobv=randn(500,1)*5; X3=randn(500,1)+2; X4=randn(500,1)*3;
figure
subplot(2,1,1);
hold on
cdfplot(Xobc); %Observed
cdfplot(X1); % Model-1
cdfplot(X2); % Model-2
set(gca, 'ylim', [0, 1.1])
title('Calibration')
subplot(2,1,2);
hold on
cdfplot(Xobv); %Observed
cdfplot(X3); % Model-1
cdfplot(X4); % Model-2
set(gca, 'ylim', [0, 1.1])
title('Validation')
xlabel('Streamflow (m^3/Sec)');
legend('Observed Streamflow','Model-1','Model-2');
I attached, my original data set plot as well. What would one get from the CDFplot at first place?? Is this a good comparison aside from the daily hydrographs? Any thoughts would be appreciated.

답변 (1개)

Walter Roberson
Walter Roberson 2017년 5월 2일
h(1, 1) = cdfplot(Xobc); %Observed
h(1, 2) = cdfplot(X1); % Model-1
h(1, 3) = cdfplot(X2); % Model-2
and
h(2,1) = cdfplot(Xobv); %Observed
h(2, 2) = cdfplot(X3); % Model-1
h(2, 3) = cdfplot(X4); % Model-2
and
set( h(:,1), 'LineStyle', '-', 'Color', 'b');
set( h(:,2), 'LineStyle', '.-', 'Color', 'g');
set( h(:,3), 'LineStyle', '--', 'Color', 'r');
  댓글 수: 2
Giuseppe Degan Di Dieco
Giuseppe Degan Di Dieco 2021년 4월 17일
Dear Walter,
thanks for your help.
It really helped me in setting my CDF plot.
May I ask you how did you find the solution?
Best.
Ritayan Biswas
Ritayan Biswas 2021년 7월 6일
Hi Walter,
Thank you for your answer, it really helped me set-up my CDF plot.
Regards :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Exploration and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by