Effacer les filtres
Effacer les filtres

Matlab shows the histogram 3 times!

1 vue (au cours des 30 derniers jours)
Tala Hed
Tala Hed le 13 Jan 2017
Commenté : Wilson A N le 16 Jan 2017
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 commentaire
Wilson A N
Wilson A N le 16 Jan 2017
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

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by