Statistic bar chart and lining the points of bar charts
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi Dears,
How can I have a line go through all the bar in the graph?
And how can I have the value of n_random label on each bar?
Please help me. I really appreciate that
clc;
close all;
clear all;
n = 50;
p = 0.2;
n_random = randi(15,1,n);
for i = 1:1:numel(n_random);
y= poisspdf(n_random(i),p);
figure (1);
yyaxis left;
bar(i,y);
hold on;
yb = cat(1, y.YData);
xb = bsxfun(@plus, h(1).XData, [h.XOffset]');
hold on;
padval = 1;
htxt = text(xb(:),yb(:)-padval, cellstr(num2str(yb(:))), ...
'rotation', 90, 'horiz', 'right');
set(htxt(1:3:end), 'color', 'w');
end
grid on;
sum1 = sum(y{i});
mean1 = mean(y{i});
fprintf('Mean of D is: %d',mean1);
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Bar Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!