Matlab shows the histogram 3 times!

1 次查看(过去 30 天)
Tala Hed
Tala Hed 2017-1-13
评论: Wilson A N 2017-1-16
I curve fit 4 distributions over a histogram. Each time that I use histfit command, it shows the corresponding histogram as well and at the end I have repetitive legends! Can any one help how to get rid of the redundant ones? The code is pretty simple!
sz=xlsread('sz418.xlsx');
mm=sz(:,1);
aa=sz(:,2);
k=histfit(mm,10,'normal')
hold on
h=histfit(mm,10,'inversegaussian')
h(2).Color = [.8 .2 .8];
p=histfit(mm,10,'lognormal')
p(2).Color = [.1 .1 .1];
pd = makedist('Normal',mean(mm),std(mm));
t = truncate(pd,0,1.2)
x = 0:.01:0.5;
plot(x,10*pdf(t,x),'Color','blue','LineWidth',2,'LineStyle',':')
hold off
  1 个评论
Wilson A N
Wilson A N 2017-1-16
I tried running this code but didn't get the error. Initially I didn't even get the legend. I had to manually force it to appear by writing the the legend('show') command at the end of the above code. May be some of the options in the documentation link below may help
https://www.mathworks.com/help/matlab/ref/legend.html

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by