Skip to content

The shape of data: distributions and histograms

The previous lesson squeezed a dataset down to a few numbers: a center and a spread. Those numbers are useful, but they throw away something important. Two datasets can share the same mean and the same standard deviation and still look nothing alike, because a couple of summary numbers cannot capture shape. To see shape, you draw a picture, and the most basic and most useful picture in all of statistics is the histogram.

A histogram is worth building once by hand, because once you see how it is made you can read any one in a glance, and reading distributions is a habit that pays off every time you look at data, your own or a model’s.

Start with raw numbers, say the time in seconds that 27 users took to finish a task. A list of 27 numbers tells you almost nothing at a glance. So you do two things: chop the range of values into equal intervals called bins, then count how many values fall into each bin and draw a bar that tall. That is the whole idea.

seconds count
0 to 2 | ############ (12)
2 to 4 | ######## (8)
4 to 6 | #### (4)
6 to 8 | ## (2)
8 to 10 | # (1)

Now the data speaks. Most users finished fast, and a shrinking tail of users took longer and longer. You did not need to read 27 numbers; the shape told you the story.

Bin choice matters. Make the bins too wide and everything collapses into one or two fat bars that hide the detail. Make them too narrow and the picture turns into spiky noise, one or two values per bin. There is no single correct bin width; the goal is the width that shows the real shape without inventing detail that is not there. When you see a histogram, it is worth asking how the bins were chosen, because the same data can be made to look smooth or jagged by that choice alone.

Most real distributions are variations on a handful of shapes, and naming them is half of reading them.

Symmetric. The left and right halves roughly mirror each other. The mean and median sit close together near the middle.

| #
| ####
| ########
| ####
| #

Right-skewed (positive skew). A long tail stretches to the right, toward the high values, while the bulk piles up on the left. This is the task-time histogram above, and it is everywhere: incomes, house prices, response times, anything bounded below by zero but unbounded above. Crucially, the long right tail drags the mean above the median, which is exactly the mean-versus-median gap from the previous lesson, now visible as a shape.

Left-skewed (negative skew). The mirror image: a long tail to the left, bulk on the right, and the mean pulled below the median. Think of exam scores on an easy test, where most students score high and a few trail off downward.

Three histograms showing right-skewed, left-skewed, and symmetric shapes with mean and median markers Three small histograms side by side, each with blue bars and a count axis. The left histogram is right-skewed: most of the data is on the left with a long tail to the right; a purple mean line sits to the right of the amber median line. The middle is left-skewed: the tail runs left, with the mean line to the left of the median line. The right histogram is symmetric, bell-shaped, with mean and median coinciding at the center. Tail labels describe the direction of the tail in each. right-skewed med mean tail → count left-skewed med mean ← tail symmetric med mean no tail
Three shapes, three relationships. When the tail trails right, the few large values pull the mean above the median (right-skew). When the tail trails left, the mean drops below the median (left-skew). When the distribution is symmetric, the two coincide at the center. The mean leans toward the long tail; the median holds steady.

Uniform. Every bin is about equally tall; no value range is favored. The roll of a fair die across many throws looks uniform.

Bimodal. Two distinct peaks instead of one.

| ######
| ##
| #
| ##
| ######

A bimodal shape is a red flag worth heeding: it often means two different populations are mixed into one column. Heights of a mixed-gender group, response times from two different server regions, or test scores from two very different classes can each produce two humps. The single “mean” of a bimodal dataset can land in the empty valley between the peaks, describing nobody.

A bimodal dataset binned three ways: too few bins hides the bimodality, a good bin width reveals two peaks, too many bins becomes noise Three small histograms side by side, each derived from the same bimodal dataset but binned differently. The left histogram uses only 4 wide bins, producing a roughly even-looking flat shape that hides the underlying two peaks. The middle uses about 16 bins and clearly shows two distinct peaks separated by a valley, the true bimodal shape. The right uses 32 narrow bins, producing a jagged spiky pattern where the shape is lost in noise. Captions below each panel name the failure mode or success. too few bins hides the bimodality count good bin width two peaks visible too many bins noise, shape lost
The same underlying dataset, binned three ways. Too few bins blur the two peaks into a single mass, hiding the bimodal story. A sensible bin width reveals the two peaks separated by a valley. Too many bins fracture the shape into spiky noise where any pattern gets lost. Bin width is a choice; choose poorly and the histogram lies.

Bell-shaped (the normal distribution). Symmetric, single-peaked, with tails that fall off smoothly on both sides. This shape is so common and so important that it gets its own lesson later in the track. For now, just learn to recognize the bell.

Looking at the distribution of a feature, or of the labels, or of a model’s outputs, is one of the cheapest and most informative things you can do before and after modeling. It routinely catches problems that summary numbers hide.

  • Skew suggests a fix. A strongly right-skewed feature (income, counts, durations) can hurt models that implicitly expect balanced spreads. Seeing the skew in a histogram is what prompts a practitioner to transform the feature (for example, working with its logarithm) so the bulk of the data is no longer crammed against one edge.
  • Two populations hiding in one column. A bimodal histogram is the tell that a single feature is really two groups stacked together. That changes how you model it, and a mean computed across both is misleading.
  • Class imbalance jumps out. Plot the histogram of the labels in a classification problem and you might find 99% of examples are one class. That is the base-rate situation from lesson 1, made visible: a model can score high by always guessing the majority class while detecting nothing. You cannot fix what you have not seen.
  • Outliers and data errors. A lone bar far out on the axis, or an impossible spike (a thousand users with an age of 0), shows up instantly in a histogram and almost never in a mean.

The discipline is simple: before you trust a column of data, look at its shape. The picture answers questions the summary numbers cannot.

  • Trusting summary numbers without seeing the shape. Same mean and standard deviation, completely different distributions; the histogram is what tells them apart.
  • Letting bin width fool you. Too-wide bins hide real structure; too-narrow bins manufacture fake spikes. Always consider how the bins were chosen.
  • Ignoring a second peak. A bimodal shape usually means two populations are mixed; treating them as one and reporting a single center describes nobody.
  • Reading skew direction backward. The skew is named for where the long tail points, not where the bulk of the data sits. Right-skewed means the tail stretches right, even though most of the data is on the left.
  • Forgetting the labels have a distribution too. In classification, the distribution of the target classes (balance versus imbalance) matters as much as any input feature, and a histogram of the labels reveals it.
  • A histogram bins the range of values and draws a bar for the count in each bin. It reveals shape, which a center and spread alone cannot capture.
  • The common shapes are symmetric, right-skewed, left-skewed, uniform, bimodal, and bell-shaped. Naming the shape is most of reading the data.
  • Skew is visible as a tail, and it explains the mean-versus-median gap from the previous lesson: the tail drags the mean toward it (right tail, mean above median; left tail, mean below).
  • A bimodal shape is a warning that two populations may be mixed in one column, and a single summary number can describe neither.
  • In machine learning, inspecting the distribution of features, labels, and outputs is a routine first step that surfaces skew, outliers, hidden subpopulations, and class imbalance that summary statistics quietly miss.