AI Glossary / Data science and analytics / Intermediate

Histogram

Definition

A histogram displays the distribution of numerical observations by dividing their range into intervals, called bins, and drawing a bar for each interval. The bars show how many observations fall in each bin, their relative frequency, or a density derived from those frequencies. The horizontal position represents numerical intervals rather than unrelated categories.

What it means

An average can hide how widely values vary or whether a few unusually large values occur. A histogram makes the overall shape easier to inspect: values may cluster around a center, have a long tail, or form more than one concentration. It summarizes the observed sample, so its appearance depends on the observations and the bins used. It does not preserve the exact value or original order of every observation.

How it works

Choose bin boundaries that cover the intended data range and specify how observations on boundaries are assigned. Count each valid observation in the appropriate bin. With equal-width bins, bar heights can directly show counts or proportions. For a probability-density histogram, divide each bin's count by the total number of observations and by that bin's width; the total bar area then equals one. This width adjustment is especially important with unequal bins. Label the vertical axis so readers can tell whether they are seeing counts, proportions, or density.

Three practical examples

  • Response-time analysis: a team inspects the distribution of request durations to see whether most are quick while a smaller number take much longer.
  • Quality monitoring: measured product dimensions are grouped into intervals to examine spread and possible unusual observations.
  • Data preparation: an analyst examines a numerical feature for concentrated values, unexpected gaps, or a long tail before selecting transformations or models.

Think of it this way

Think of sorting measured lengths into trays, with each tray labeled by a numerical interval. The amount in each tray reveals where observations accumulate. The analogy needs one qualification: if trays cover different interval widths, their contents alone do not express concentration per unit of length. A density histogram accounts for that difference.

Worked example

Suppose 12 waiting times, in minutes, are 1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, and 10. Use bins from 0 up to but not including 5, from 5 up to but not including 10, and from 10 up to but not including 15. Their counts are 5, 6, and 1. The relative frequencies are 5/12, 6/12, and 1/12, approximately 41.7%, 50%, and 8.3%.
For density heights, divide each proportion by the width of 5 minutes. The heights are approximately 0.0833, 0.1000, and 0.0167 per minute. Multiplying each height by its width recovers its proportion, and the three areas sum to one. If the last bin instead extends from 10 to 20, its width becomes 10 and its density height becomes approximately 0.00833 per minute. Its area remains 1/12. Giving that wider bin the same height as before would misrepresent its share in a density display.

Illustrative case study

In a fictional service dashboard, a team presents a histogram of completed requests and notices a short right tail. A reviewer discovers that requests still running at the end of the reporting period were omitted. Some of those may be the longest requests, so the chart cannot be interpreted as the full distribution of all request durations without addressing that selection. The team clarifies the population shown and develops a separate way to monitor unfinished work. The case concerns data coverage, not a claim that changing bins can repair missing observations.

Common misconceptions and mistakes

A histogram is not the same as a bar chart of named categories. Bin width can hide or exaggerate apparent structure: very wide bins may obscure detail, while very narrow bins may emphasize sampling noise. A gap in a small sample does not necessarily imply an impossible value. The tallest bar in a density histogram need not contain the largest number of observations if widths differ. A density height can exceed one because probability corresponds to area, not height alone. A histogram also does not show the time sequence in which values occurred.

Business use

Use histograms to investigate variation before relying on averages or model assumptions. State the measured unit, included population, sample size, and reporting period. Check whether missing values, filtering, rounding, or truncation affect the shape. For comparisons between groups, use compatible boundaries and make clear whether differences reflect sample size or distributional shape. If a decision depends on a service threshold, calculate the actual proportion beyond that threshold rather than estimating it only from a broad bin that spans both sides.

People also ask

Does every histogram use equal bins?

No, but unequal widths require particular care, especially with density and area interpretation.

Does the tallest bar always contain the most observations?

With equal widths and a common scaling it does; with unequal-width density bars it need not.

Can a histogram prove normality?

No. It can suggest a shape, but its appearance depends on sample size and bin choices.

Check your understanding

Why must the last density bar become half as high when its width changes from 5 to 10 minutes but it still contains one of 12 observations?

Answer: Its area must remain 1/12. Doubling the width requires halving the height to preserve that area.

Related terms

  • Frequency distribution
  • Bar chart
  • Skewness
  • Outlier
  • Cumulative distribution
  • Exploratory data analysis
  • bin width
  • probability density

Learn next

Construct several histograms of the same small dataset using different bin widths and boundaries. Compare the visible patterns with a sorted list of the original values. Then study an empirical cumulative distribution, which shows accumulated proportions without requiring the same bin choices.

  • Cumulative distribution

More in Data science and analytics

  • Greedy algorithms - Greedy algorithms build a solution by repeatedly choosing the option that looks best according to a specified local rule.
  • Harking - HARKing means hypothesizing after the results are known and presenting the resulting hypothesis as though it had been proposed before examining those results.
  • Heatmap - A heatmap is a visualization that represents numerical values using color.
  • Immutable Data Types - Immutable data types are types whose objects do not support changes to their own value after creation.
  • Independent Events - Independent events are events for which the probability of their joint occurrence equals the product of their individual probabilities: P(A and B) = P(A)...
  • Independent variable - An independent variable is a variable used as an input or explanatory factor when studying or predicting an outcome.

Sources

NIST, histogram definitions and normalized counts: https://www.itl.nist.gov/div898/handbook/eda/section3/eda33e.htm NIST Dataplot, histogram implementation and unequal-width bins: https://www.itl.nist.gov/div898/software/dataplot/refman1/auxillar/histogra.htm MIT, probability teaching material including density histograms: https://openlearninglibrary.mit.edu/assets/courseware/v1/234b658e180556b802ed8869b8b0e2c7/asset-v1%3AMITx%2B18.05r_10%2B2022_Summer%2Btype%40asset%2Bblock/pdf_mit18_05_s22_1805-probability.pdf

Previous: Hinton diagrams Next: Histogram-Based Gradient Boosting

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer