0
$\begingroup$

How can a histogram be created when the "Probability" option is used, and a specified bin width is needed?

In the example below, I am trying to set the bin width to 1, but Mathematica throws an error:

 Histogram[data, Automatic, "Probability", {1}]
$\endgroup$

closed as off-topic by corey979, JimB, m_goldberg, MarcoB, Edmund Sep 15 at 10:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – corey979, JimB, m_goldberg, MarcoB, Edmund
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Try "PDF"...... $\endgroup$ – OkkesDulgerci Sep 11 at 11:50
  • $\begingroup$ I thought PDF was exclusively for situations where the distribution is known. I am using data... $\endgroup$ – user120911 Sep 11 at 12:01
  • $\begingroup$ The docs say Histogram[data,bspec,hspec], where bspec is the bin width specification, and hspec – bin height. $\endgroup$ – corey979 Sep 11 at 12:24
  • $\begingroup$ The histogram is a bit outdated. Try SmoothHistogram or SmoothKernelDistribution. $\endgroup$ – JimB Sep 11 at 16:01
3
$\begingroup$

Try this:

Histogram[data, {x}, "Probability"]; x is your bin size.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.