フィルターのクリア

ovlay cdf plot on histogram

3 ビュー (過去 30 日間)
John
John 2012 年 10 月 5 日
Hi there,
I'm trying to overlay a cdf plot over a histogram like in this picture
I'm using this code but the cdf plot is not showing up over the histogram.
hist(x)
hold on
cdfplot(x)
I would appreciate any help.
Thanks

採用された回答

Tom Lane
Tom Lane 2012 年 10 月 5 日
編集済み: Tom Lane 2012 年 10 月 6 日
It's there but it's on the histogram scale and it is obscured by the bars. Try this instead to put the cdf on a separate y axis:
x = randn(30,1);
[y2,x2] = ecdf(x);
[y1,x1] = hist(x);
plotyy(x1,y1,x2,y2,@(x,y)bar(x,y,1,'c'),'stairs')
  1 件のコメント
Giuseppe Degan Di Dieco
Giuseppe Degan Di Dieco 2021 年 4 月 17 日
Dear Tom,
thank you for your explanation.
It helped me to produce the graph attached.
Best.
Best.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by