matlab - Add 2 histograms fit line and change colour -
matlab - Add 2 histograms fit line and change colour -
i have next code:
% histograms histfit(s,40,'normal') hold on; hist(r,40,'normal') g=findobj(gca,'type','patch'); set(g(1),'facecolor',[0 .5 .5],'edgecolor','w') set(g(2),'facecolor',[0 1 1],'edgecolor','w') set(gca,'fontsize',18,'fontname','euclid') xlabel('r & s') hold off;
i can add together 1 fist histogram fit line. want alter colour of fit line of first histogram , add together , alter fit line colour of sec histogram.
regards
well missing phone call histfit sec histogram, line not appear @ all. here sample code works fine. notice how utilize findobj fetch actual lines , alter colors:
rng default; % reproducibility %// generate dummy info s = normrnd(10,1,100,1); r = 3*normrnd(10,1,100,1); % histograms histfit(s,40,'normal') hold on; histfit(r,40,'normal') %// lines here hlines = findobj('type','line') set(hlines(1),'color','k') set(hlines(2),'color','b') g=findobj(gca,'type','patch'); set(g(1),'facecolor',[0 .5 .5],'edgecolor','w') set(g(2),'facecolor',[0 1 1],'edgecolor','w') set(gca,'fontsize',18,'fontname','euclid') xlabel('r & s') hold off;
giving this:
matlab colors histogram normal-distribution
Comments
Post a Comment