Mathematica: Extracting histogram information

In summary, to extract histogram information in Mathematica, you can use the HistogramList function. If you want to customize the bin sizes, you can use the Histogram function and specify the number or width of the bins. To save the histogram plot, you can use the Export function and choose from various file formats. It is possible to overlay multiple histograms by using the Show function. Additionally, you can add labels and a legend to the histogram plot by using the PlotLabel and PlotLegends options in the Histogram function.
  • #1
Niles
1,866
0
Hi

I have a histogram of some numbers following a PDF, such as
Code:
Histogram[RandomReal[1, 100]]
What I want is to extract the information contained in this histogram in a list, i.e. get a list of the bin value (e.g. the average value it represents) and the number of entries in it. Is using bincounts the easiest way to obtain the number of entries? Then I guess I can manually find the average value of the bin.


Niles.
 
Physics news on Phys.org
  • #2
I have succesfully used bincounts, and then manually found the average bin-value. So all OK!Niles.
 

1. How do I extract histogram information in Mathematica?

To extract histogram information in Mathematica, you can use the HistogramList function. This function takes in a list of data and returns a list of bin counts and bin ranges for the histogram.

2. Can I customize the bin sizes in a histogram using Mathematica?

Yes, you can customize the bin sizes in a histogram using the Histogram function in Mathematica. The Histogram function allows you to specify the number of bins or the width of each bin.

3. How can I save the histogram plot in Mathematica?

You can save the histogram plot in Mathematica by using the Export function. This function allows you to save the plot in various file formats such as PDF, JPEG, or PNG.

4. Is it possible to overlay multiple histograms in Mathematica?

Yes, you can overlay multiple histograms in Mathematica by using the Show function. This function allows you to combine multiple plots, including histograms, into one plot.

5. Can I add labels and a legend to the histogram plot in Mathematica?

Yes, you can add labels and a legend to the histogram plot in Mathematica by using the PlotLabel and PlotLegends options in the Histogram function. These options allow you to customize the appearance of the plot and add a legend to identify the different data sets.

Similar threads

  • High Energy, Nuclear, Particle Physics
Replies
9
Views
2K
Replies
3
Views
4K
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • Calculus and Beyond Homework Help
Replies
4
Views
14K
Replies
11
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
3K
  • Advanced Physics Homework Help
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Set Theory, Logic, Probability, Statistics
2
Replies
37
Views
4K
Back
Top