4

Lets say one wants a histogram . Say how many trades for a stock occurred on that day. And they are dead set on a histogram/bar graph. (as opposed to other representations

why are histograms typically like this , and should this always be the case ?

enter image description here

Instead of like this

enter image description here

**In specific if you are determining how many trades happened each day or each month for a stock which one is better. I think there should be space but i still have some doubt because its not really a bin. **

here is an article i found but i feel like there must be some sigchi or better articles out there

2
  • can someone add histogram to this as a tag please im not at 300 rep yet Apr 22, 2014 at 18:27
  • In reading the linked article, my takeaway is that the key difference is that a histogram is the individual sums that make up one complete whole. Not having a gap helps (IMHO) make that clearer and differentiates it from a bar chart (which usually isn't showing parts of a whole, but comparing separate wholes). In the end, though, it's perhaps a matter of semantics to decide how to best present particular data.
    – DA01
    Apr 22, 2014 at 18:33

1 Answer 1

14

From Wikipedia:

In statistics, a histogram is a graphical representation of the distribution of data. It is an estimate of the probability distribution of a continuous variable.

The emphasis is on continuous variable, as opposed to discrete variable.

The histogram

In the top histogram you've presented, the X axis is time, which is continuous in this context (it is divided to 10 minute bins, but the original data could have been in resolution of seconds, milliseconds, nanoseconds and so forth).

The way such histogram is derived is they probably had many samples, say 50,000 visits. It makes no sense to present a bar per visit time - the data will be useless; like if 900 users spent 1:42, nobody spent 1:41, and 800 spent 1:40 on the site. The average is much more important. So in this case, the samples were ordered and averaged into bins. In the graph you've provided, each bin represents 10 minutes.

Since the X axis is time, had they left any gap, it could mean that nobody spent time between 10 and 11 minutes. But this is not correct.

You could, in theory, replace this histogram with a bar graph, where the first bar would have an X value of 0-10 minutes, the second 10-20 minutes, and so forth. But the problem would be that you'd have 10 minutes sealing one bar and opening another (which makes no sense). So you'd have to change it to 00:00-10:00 minutes for the first bar, 10:01-20:00 minutes for the second bar, and so on. Which would be valid if your samples are down to a second resolution (if not, you may have to use 10:01:01 or all sorts of long time formats). It is much easier to show this on a histogram.

The bar-chart

In the bottom graph, the X axis is months - clearly a discrete variable.

To generate this bar graph, they simply count visits to the US each month - there is no problem putting spaces on the X axis as it isn't continuous. The visual representation is valid.

2
  • i like your answer but what about days? Apr 23, 2014 at 17:25
  • It depends - if it's 'days of the week' you present (say, server load per day of the week), a bar chart would be appropriate. But if you show traffic of a site over 5000 days, it is likely that averaging into bins (ie, weeks) and using a continuous X axis (histogram) is the way forward.
    – Izhaki
    Apr 23, 2014 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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