draw a histogram from an array

4 vues (au cours des 30 derniers jours)
alpedhuez
alpedhuez le 16 Juil 2022
Commenté : Image Analyst le 18 Juil 2022
I now have an array
date visitors
------ --------
1/1 5
1/2 10
1/3 12
What is the simplest way to draw a histogram of visitors?

Réponse acceptée

Image Analyst
Image Analyst le 16 Juil 2022
Modifié(e) : Image Analyst le 16 Juil 2022
Did you try
bar(t.Data, t.Visitors);
grid on;
xlabel('Date');
ylabel('Number of Visitors');
This assumes that your histogram is in a table like you showed.
  2 commentaires
alpedhuez
alpedhuez le 16 Juil 2022
histogram(t.Visitors)
Image Analyst
Image Analyst le 18 Juil 2022
You'd need more than 3 samples. But if you have like hundreds of days, then that could get you a distribution of how many people visited during a certain interval of time (like one day or one week).

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by