how to plot cdfplot with different line style?
78 次查看(过去 30 天)
显示 更早的评论
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
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
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
2021-7-6
Hi Walter,
Thank you for your answer, it really helped me set-up my CDF plot.
Regards :)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!