Is it okay to add error bars into a histogram plot?

In summary, the error bars were produced by taking the Poisson of the counts, i.e. if N are the counts the error bars was ##\sqrt{N}##.
  • #1
tryingtolearn1
58
5
Homework Statement
Is it okay to include error bars in a histogram plot?
Relevant Equations
None
I made a histogram based off a dataset and I calculated the uncertainty of the measurements and I included the error bars into my histogram. Is that okay? I am asking because I never seen error bars included with a histogram. I have included an image of my histogram below:
 

Attachments

  • 550mV.png
    550mV.png
    12.4 KB · Views: 120
Physics news on Phys.org
  • #2
Most histograms are of exactly known numbers, so no error bars.
Please describe how you arrived at these error bars.
 
  • #3
Hi,

I would say yes.
When I look at the picture a few other things strike me:
The red dots have no function (and are not in the legend)
Names in legend are rather meaningless ('histogram'?, 'best fit curve'?)
Y axis is anything but Events/Bins
The title discriminator threshold doesn't seem to apply to the picture but to be some experimental setting
##\chi^2_r =1.0## always makes me suspicious (not paranoid, just experienced... :wink: )

##\ ##
 
  • Like
Likes DaveE
  • #4
Unless you are specifically required to do otherwise, you might consider not using a histogram at all - just the data-points/error-bars plus the best-fit curve.

If the graph is known to represent some sort of exponential process, a more useful approach might be to make a graph with ln (natural logarithm) of the 'y-axis' values. This should give a straight line where the gradient will have a physical meaning. (If you plot such a graph, then using a histogram would be inappropriate IMO.)
 
  • Like
Likes tryingtolearn1 and DaveE
  • #5
I agree with @Steve4Physics. A good graph should contain lots of information in a simple self-explanatory manner: making a good one requires some visual design. The histogram format adds nothing. Also the box telling us that the error bars are error bars is superfluous...
 
  • Like
Likes tryingtolearn1 and DaveE
  • #6
Steve4Physics said:
Unless you are specifically required to do otherwise, you might consider not using a histogram at all - just the data-points/error-bars plus the best-fit curve.
In general, it is not an open choice. Histograms are normally used when there is a single undifferentiated list of numbers. There are no (x,y) pairs from which to plot a graph.
That's why I asked how the errors bars are derived. There is not usually any basis for such in a histogram.
We need need more background from @tryingtolearn1.
 
  • Like
Likes Steve4Physics and hutchphd
  • #7
haruspex said:
Most histograms are of exactly known numbers, so no error bars.
Please describe how you arrived at these error bars.
The error bars were produced by taking the Poisson of the counts, i.e. if N are the counts the error bars was ##\sqrt{N}##.
BvU said:
Hi,

I would say yes.
When I look at the picture a few other things strike me:
The red dots have no function (and are not in the legend)
Names in legend are rather meaningless ('histogram'?, 'best fit curve'?)
Y axis is anything but Events/Bins
The title discriminator threshold doesn't seem to apply to the picture but to be some experimental setting
##\chi^2_r =1.0## always makes me suspicious (not paranoid, just experienced... :wink: )

##\ ##
Thanks I will modify my plot based off these suggestions
 
Last edited:
  • Like
Likes Dale
  • #8
haruspex said:
In general, it is not an open choice. Histograms are normally used when there is a single undifferentiated list of numbers. There are no (x,y) pairs from which to plot a graph.
That's why I asked how the errors bars are derived. There is not usually any basis for such in a histogram.
We need need more background from @tryingtolearn1.
I was able to find a lab report similar to mine that illustrates the usage better. If you look at page 3, in this link: https://sites.fas.harvard.edu/~phys191r/References/b4/Coan2006.pdf

the plot there is very similar to mine except they didn't include the histogram.
 
  • #9
tryingtolearn1 said:
I was able to find a lab report similar to mine that illustrates the usage better. If you look at page 3, in this link: https://sites.fas.harvard.edu/~phys191r/References/b4/Coan2006.pdf

the plot there is very similar to mine except they didn't include the histogram.
It states that figure 3 is a histogram - they just haven't shown the columns - and it does show error bars, apparently calculated the same way you have done.

To me, it is an unusual use of the concept of an error bar, though. There are no actual errors, these are exact counts. I can see they represent uncertainty in that if you were to rerun the experiment these are the ranges of counts you expect in each bucket. But the uncertainties in neighbouring buckets are not independent.
The uncertainty is not so much in the individual counts as in the buckets the observations should have gone in. If another run of the experiment produces a larger count in one bucket it will very likely produce lower counts in neighbouring buckets.
To look at it another way, if one bucket has a lower count than both neighbours then its error bar should extend further above its count than below that.

I feel there's a better way. I'll think about it some more.
 
  • Like
  • Informative
Likes Steve4Physics, hutchphd, BvU and 1 other person
  • #10
Further thoughts...
I presume the aim is to estimate the Poisson parameter. If we have time samples (ti) and a supposed parameter λ then the joint pdf is ##p((t_i)|\lambda)=\Pi\lambda e^{-\lambda t_i}=(\lambda e^{-\lambda\bar t})^n##, where ##\bar t## is the average time.
Clearly this is maximised at ##\hat\lambda=\frac 1{\bar t}##. You can plot ##p((t_i)|\lambda)## against λ and compute the standard deviation for λ.
You could then return to the histogram, draw the curve through it for ##\hat\lambda##, and curves one (or two) standard deviations either side as the "error bar".
 
  • Like
Likes tryingtolearn1
  • #11
tryingtolearn1 said:
I was able to find a lab report similar to mine that illustrates the usage better. If you look at page 3, in this link: https://sites.fas.harvard.edu/~phys191r/References/b4/Coan2006.pdf

the plot there is very similar to mine except they didn't include the histogram.
Probably down to aesthetics. Drawing a conventional histogram would produce something extremely cluttered and hard-on-the-eye, especially with error bars.

Also worth noting is that the graph in your link uses a logarithmic scale.
 
  • Like
Likes tryingtolearn1

1. Can error bars be added to a histogram plot?

Yes, error bars can be added to a histogram plot to show the variability or uncertainty in the data.

2. How are error bars calculated for a histogram plot?

Error bars for a histogram plot can be calculated using different methods, such as standard deviation, standard error, confidence intervals, or percentiles. The method used will depend on the type of data and the research question being addressed.

3. What is the purpose of adding error bars to a histogram plot?

The purpose of adding error bars to a histogram plot is to provide a visual representation of the variability or uncertainty in the data. This can help to better understand the data and make more accurate interpretations or comparisons.

4. Are error bars necessary for all histogram plots?

No, error bars are not necessary for all histogram plots. They are most useful when there is variability or uncertainty in the data that needs to be represented. If the data is highly consistent, error bars may not be necessary.

5. Can error bars be added to a histogram plot in all software programs?

Yes, most software programs that are used for creating histogram plots have the capability to add error bars. However, the method for adding error bars may vary between programs, so it is important to consult the software's documentation for specific instructions.

Similar threads

  • Programming and Computer Science
Replies
3
Views
1K
  • Atomic and Condensed Matter
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
20
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
991
  • Introductory Physics Homework Help
Replies
15
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
912
  • Introductory Physics Homework Help
Replies
11
Views
622
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
791
  • Introductory Physics Homework Help
Replies
4
Views
553
Back
Top