Plotting a histogram (setting the color) with a fit distribution
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I have the histogram on the left.
However, by applying the histfit() command I get the figure on the right.
I would like to return the same histogram on the left to the histogram on the right. How can i do that?
I use these lines of code:
H = histogram(A,'facecolor', [0 1 1], 'facealpha',.1,'edgecolor','k');
histfit(A)
where "A" is a vector of about 10000x1 double
0 commentaires
Réponse acceptée
KSSV
le 5 Mai 2022
H = histogram(A,'facecolor', [0 1 1], 'facealpha',.1,'edgecolor','k');
h = histfit(A) ;
% get the data of hist-fit
x = h(2).XData ;
y = h(2).YData ;
% now you go to the first figure or plot the histogram yoou want like
H = histogram(A,'facecolor', [0 1 1], 'facealpha',.1,'edgecolor','k');
hold on
plot(x,y,'b') % lot the fit curve
2 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!