Plotting a histogram (setting the color) with a fit distribution
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
KSSV
on 5 May 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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!