Why does hist, histogram and how the shape of my data is affect how my results are displayed?

2 views (last 30 days)
I have these 3 plots:
and depending if the sizes are Nx10 or 10Nx1 it displays it differently. On top of that it acts differently depending if its a single vector or if its organized in columns and rows. What are the differences between them and how MATLAB choosing how to display each one?
  1 Comment
Image Analyst
Image Analyst on 23 Jul 2018
histogram() treats vectors and matrices the same way. What functions are you using, and what version are you using (list the release on the right).

Sign in to comment.

Answers (1)

yeungor
yeungor on 23 Jul 2018
Well, you described two situations and two different functions and gave three plots, so I am somewhat confused.
I would say that having an m-by-n matrix input would be interpreted as n different experiments where in each experiment, m datapoints were collected. So each different color is for each of the n experiments and each of the 10 different groupings is a different bin. Note that hist always has 10 bins if unspecified, so I'm guessing you used hist for the second plot.
The 3rd plot appears to be generated by histogram and it treats all the data as from the same experiment, so it has no reason to choose different colors. However, I don't know how you got the evenly spaced dark lines, would you be able to append code to your question?
My last guess is that since the first plot has 10 bins you used hist on the vectorized data.

Tags

Products

Community Treasure Hunt

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

Start Hunting!