Statistic bar chart and lining the points of bar charts

4 vues (au cours des 30 derniers jours)
Tu Nguyen
Tu Nguyen le 25 Mar 2022
Modifié(e) : Cris LaPierre le 26 Mar 2022
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
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;
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');
Dot indexing is not supported for variables of this type.
grid on;
sum1 = sum(y{i});
mean1 = mean(y{i});
fprintf('Mean of D is: %d',mean1);

Réponses (0)




Community Treasure Hunt

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

Start Hunting!

Translated by