A histogram shows how numerical values are distributed. It groups observations into intervals, called bins, and uses bars to show how many values fall within each interval.
Suppose you measure the response times of 10,000 API requests. Their average might be 180 milliseconds, but that number alone cannot tell you whether most requests finished quickly or whether a smaller group experienced substantial delays. A histogram helps reveal where the observations cluster, how widely they vary, and whether unusually high or low values deserve a closer look.
The challenge is that a histogram's appearance depends heavily on how you group the data. Change the bin width, and the same observations can appear smooth, scattered, or divided into several peaks.
We’ll look at how histograms work, how to read their shapes, and how to choose useful bins. Simulated examples will illustrate four common distribution shapes, while interactive Deepnote charts will show how binning and grouping affect real datasets.
What is a histogram?
A histogram is a chart that divides a numerical variable into intervals and counts the observations within each interval.
Consider a restaurant dataset containing 244 bills. Each record has a total amount in dollars. We can group these amounts into $5 intervals and count the bills in each group.
Each bar represents a range of bill amounts. A bar covering $10 to $15 shows how many bills fall within that interval, while the next bar represents bills from $15 to $20.
This is the main difference between a histogram and a conventional bar graph. A bar graph compares distinct categories, such as product names or departments. A histogram shows the frequency distribution of numerical measurements.
The bars normally touch because their intervals form a continuous numerical scale. A gap between histogram bars generally means an interval contains no observations.
Histograms are useful for measurements such as transaction values, salaries, response times, customer ages, and test scores. They help answer questions about the entire range of observations instead of concentrating on a single summary statistic.
Histogram key components & parts
A histogram has two main axes and a set of bins. Understanding how they work makes the rest of the chart easier to interpret.
Bins and bin width in a histogram
A bin is an interval containing a range of numerical values. Bin width describes how much of the numerical scale each interval covers.
If we measure transaction values in dollars, we might use intervals of $0 to $10, $10 to $20, and $20 to $30. These have a width of $10.
Each observation must belong to one bin. For example, if the bins include their lower boundary but exclude their upper boundary, a value of exactly $10 belongs in the $10–$20 bin, not the $0–$10 bin.
Bin width matters because it determines how much detail the chart retains. Wide bins combine more observations, while narrow bins divide the data into smaller groups.
The frequency axis in a histogram
In a standard histogram, the horizontal axis shows the numerical variable and the vertical axis shows frequency, or the number of observations in each bin.
A frequency of 30 means that 30 observations fall within the corresponding interval.
Some histograms use percentages or probability density instead of counts.
A percentage histogram shows what share of the observations falls within each bin. A density histogram scales the bars so that their total area equals one. With equal-width bins, these versions generally preserve the distribution's shape, although their vertical scales differ.
Be careful when interpreting histograms with unequal bin widths. Wider bins naturally cover more of the numerical range, so comparing bar heights alone can be misleading. Using frequency density, calculated by dividing each bin's count by its width, makes the area of each bar proportional to its frequency.
What bar height means in a histogram
For a standard count histogram with equal-width bins, taller bars contain more observations.
But height does not tell us anything about the order in which those observations occurred.
A histogram of website response times can show that many requests took between 100 and 200 milliseconds. It cannot show whether those requests happened on Monday, during a traffic spike, or after a particular release.
If the sequence of observations matters, we may need a time-series chart alongside the histogram.
Histogram use cases
Use a histogram when you need to understand the range and distribution of individual numerical measurements.
Use case | Question it can answer |
|---|---|
Service performance | Do most requests finish quickly, or is there a long tail of slow responses? |
Transaction analysis | Which order-value ranges are common, and how often do unusually large purchases occur? |
Quality control | Are measurements concentrated near the intended size, or widely spread? |
Delivery operations | How much do delivery times vary across individual orders? |
Assessment results | Are scores concentrated near the top, spread evenly, or clustered into groups? |
Data-quality checks | Are there gaps, unexpected peaks, or extreme values worth investigating? |
Use individual observations rather than averages for each group. A histogram of three regional averages cannot show the variation among all the transactions in those regions.
How to read a histogram
When reading a histogram, start with the numerical scale and look at the overall distribution before examining individual bars.
1. Find where values are concentrated
Look for the tallest bars and the intervals around them. These show the ranges containing the greatest numbers of observations.
In the restaurant bill example, most observations fall within the lower and middle bill ranges, with fewer records toward the highest values.
That tells us more than a single average bill amount. It shows which amounts are common and how frequently larger bills occur.
The tallest interval is called a modal bin. It contains the largest frequency for the chosen binning scheme. The modal bin is not necessarily the interval containing the mean or median.
2. Check the spread
Spread describes how widely values vary.
A histogram with observations concentrated within a narrow range indicates less variation than one with values distributed across a much wider range, assuming both use comparable scales.
For a service's response times, a narrow distribution might indicate relatively consistent performance. A wide distribution could signal that users experience substantially different delays.
The histogram alone won't explain why the values vary. It tells us where further investigation may be useful.
3. Look for skewness
A distribution is skewed when one side extends farther than the other.
A right-skewed distribution has a longer tail toward higher values. Transaction amounts and request latencies often show this pattern because many observations are relatively small while a smaller number are much larger.
A left-skewed distribution has a longer tail toward lower values.
Skewness matters because a few extreme observations can pull the mean away from the more typical values. For strongly skewed data, the median and percentiles may provide a more useful summary than the mean alone.
4. Count the peaks
A distribution with one clear peak is called unimodal. A distribution with two noticeable peaks may be bimodal, while one with several peaks is multimodal.
Multiple peaks are often interesting because they can reflect different groups of observations.
For example, a response-time histogram could combine requests served from a cache with requests requiring a database query. Those processes might produce different response-time patterns.
That is a hypothesis to investigate, though. The histogram does not establish that separate processes caused the peaks.
5. Examine gaps and extreme values
An empty interval may indicate a genuine gap in the observations. It could also result from the selected bin width or a small sample.
Likewise, a thin tail containing a few distant values may suggest potential outliers.
Before labeling observations as outliers, inspect the original measurements and consider whether the unusual values are plausible. A legitimate high-value transaction should not be discarded merely because it sits far from the rest of the distribution.
A histogram helps us notice unusual patterns. Determining their causes requires more information.
How to choose the right histogram bin width
Bin width is one of the most consequential decisions in histogram design. It changes what readers can see without changing a single observation.
We can demonstrate this using the same 244 restaurant bills.
All three charts use identical data. Only the intervals differ.
With $10 bins, the overall distribution is easy to see, but many individual differences disappear into broad groups. At $5, we retain more detail while preserving a readable shape. At $2, the chart becomes more irregular because fewer observations fall within each interval.
There is no universally correct bin width. The choice depends on the number of observations, their spread, and the question we're asking.
What happens when bins are too wide?
Very wide bins can conceal useful structure.
Imagine a dataset containing two distinct clusters of response times. If the intervals are wide enough, the histogram may combine those clusters into one broad peak.
The resulting chart would hide a pattern that could matter to the analysis.
Wide bins are useful for a quick overview, but they can oversimplify the distribution.
What happens when bins are too narrow?
Narrow bins preserve more local detail, but they can produce a noisy chart with many small peaks and empty intervals.
That can encourage readers to interpret random fluctuations as meaningful patterns.
The issue is especially noticeable with small datasets. If you have only 50 observations and divide the range into 100 intervals, most bins will be empty.
Common bin-width rules
Statistical software often estimates an initial bin width using established methods.
Scott's rule uses the standard deviation and sample size to estimate a suitable width. The Freedman-Diaconis rule uses the interquartile range, making it less sensitive to extreme values.
The Freedman-Diaconis rule calculates bin width as:
Bin width = (2 × IQR) / cube root of n
Here, IQR is the interquartile range (the third quartile minus the first quartile), and n is the number of observations.
You don't need to calculate this manually for every chart. Many plotting libraries provide automatic binning.
We still recommend checking more than one reasonable width, particularly when the distribution appears to contain multiple peaks or unusual gaps.
Also keep the bin boundaries consistent when comparing histograms. Two charts with different starting points or bin widths can look different even when their underlying distributions are similar.
Common histogram shapes and what they mean
Four common shapes are bell-shaped, right-skewed, left-skewed, and approximately uniform. They describe where observations concentrate and how frequencies change across the range.
The illustrations below use simulated data to make each pattern easy to recognize. Real datasets may show less distinct shapes, and changing the bins can affect their appearance.
Normal or bell-shaped distributions
A bell-shaped histogram has one central peak, with frequencies tapering off roughly symmetrically on either side. Most observations lie near the center, with fewer toward the extremes.
For example, repeated fill-volume measurements from a stable bottling process might cluster around the intended amount. The illustration shows simulated measurements centered on 500 milliliters.
A bell-shaped appearance can be consistent with a normal distribution, but the histogram alone does not establish normality.
Right-skewed distributions
A right-skewed distribution has a longer tail toward higher values. Many observations are relatively low, while fewer extend much farther to the right.
Response times can follow this pattern: most requests finish quickly, but a smaller number take much longer. The illustration shows simulated response times with a long upper tail.
The direction of skew follows the tail, not the tallest bar. Here, the tail points right even though most observations sit toward the left.
Left-skewed distributions
A left-skewed distribution has a longer tail toward lower values. Most observations are relatively high, while fewer extend farther to the left.
For example, an assessment may produce mostly high scores with a smaller group of low scores. The illustration uses simulated scores to show this pattern; it does not establish why a real group performed that way.
As with right skew, inspect the tail to identify the direction. A low-score tail makes this distribution left-skewed.
Uniform or rectangular distributions
In a continuous uniform distribution, equal-width intervals within the range have equal probabilities. A sample histogram therefore looks roughly flat, although its bars will usually differ somewhat in height.
For example, a random-number generator can sample values uniformly between zero and one. No equal-width interval is favored over another.
The small differences between these bars reflect variation in the simulated sample. A uniform distribution does not require every sample to produce identical bin counts.
Bimodal and multimodal distributions
Some histograms contain two or more noticeable peaks.
The Iris dataset gives us a useful example. It contains measurements for 150 flowers across three species.
When we plot petal length without separating the species, the distribution shows distinct concentrations of values.
Now split those measurements by species.
The smaller petal measurements largely belong to the setosa species, while the other species occupy higher, partly overlapping ranges.
This illustrates why multiple peaks can matter. A combined distribution may contain distinct subgroups with different characteristics.
In business analysis, the equivalent might be transaction values from different customer segments or response times from separate application endpoints.
When a histogram looks multimodal, check whether a meaningful grouping variable helps explain the shape.
Histogram vs. bar graph
A histogram shows the distribution of numerical observations across intervals. A bar graph compares values across distinct categories.
Suppose we record the delivery time of 1,000 orders. A histogram would group the individual delivery times into intervals to reveal their spread. A bar graph might compare the average delivery time across three delivery services.
Histogram intervals have a meaningful numerical order and typically touch. Bar graph categories may be reordered, and their bars are usually separated. You can use the histogram vs. bar graph comparison for a more detailed side-by-side example, or the bar graph maker when your data calls for categorical comparisons.
Histogram examples with real data
The following examples use public datasets to show what different histogram designs reveal.
Example 1: Restaurant bill amounts
The Plotly tips dataset contains 244 restaurant bills, including the total bill amount and tip for each observation.
Here, we use $5-wide intervals again, but display each interval as a percentage of the 244 bills instead of a raw count.
The distribution is right-skewed. Lower and moderate bill amounts are more common, while relatively few observations fall in the highest ranges.
This matters when interpreting summary statistics. If a restaurant team wanted to understand the typical recorded transaction, a median could be more informative than relying solely on the mean.
The percentage histogram makes it easier to see what share of bills falls within each range. The underlying distribution is unchanged, but the vertical axis now shows proportions rather than counts.
Example 2: Iris flower measurements
The Iris dataset contains four numerical measurements for each flower, including petal length.
The combined histogram earlier in the article showed distinct concentrations of petal lengths. We can examine those differences more closely by plotting each species in a separate panel using the same bin widths and numerical scale.
Setosa flowers occupy a noticeably lower petal-length range than the other species. Versicolor and virginica have higher measurements, with considerable overlap between their ranges.
Separating the groups makes the distribution easier to interpret. It also illustrates why checking for hidden subgroups can matter when analyzing a combined population.
Example 3: Life expectancy across countries
Plotly's Gapminder extract includes country-level life expectancy estimates. We selected the 142 country observations recorded for 2007.
Each observation represents one country. The histogram shows the frequency of countries across life expectancy intervals.
We can then separate the observations by continent.
The groups have different distributions, helping us understand why the combined histogram looks the way it does.
This example requires one important qualification: countries contribute equally to the histogram, regardless of population size. It shows the distribution across countries, not the distribution of life expectancy across the world's people.
That distinction matters whenever observations represent groups of unequal size.
How to make a histogram
You can make a histogram using spreadsheet software, Python, or an AI chart generator. The basic process is to supply individual numerical observations, choose sensible intervals, and check that the frequency counts match the source data.
Make a histogram with Deepnote Agent
In Deepnote’s histogram maker, give Agent the dataset, numerical variable, and binning requirements in one request.
This example loads the restaurant-bill dataset through Plotly and uses individual bill amounts rather than a precomputed summary:
Load the restaurant-bill dataset using
plotly.express.data.tips(). Use each row’s total_bill value as one observation.Check for missing or nonfinite bill amounts and report any exclusions. Do not remove valid high bills merely because they are unusual.
Create an interactive histogram with $5-wide bins from $0 to $55. Include each bin’s lower boundary and exclude its upper boundary, except that the final bin should include $55. Verify that every valid observation falls within the displayed bins.
Title the chart “Distribution of restaurant bill amounts.” Label the horizontal axis “Total bill (USD)” and the vertical axis “Number of bills.” Use touching bars and start the count axis at zero.
Show a table of bin ranges and counts. Verify that the dataset contains 244 records and that the histogram counts sum to the number of valid bill amounts. Report the mean and median, and describe the visible shape without inferring its cause. Identify the source as Plotly’s historical tips sample.
The bin-count table lets us check that each valid bill was included once. The mean and median provide summaries, while the histogram shows the variation those summaries leave out.
A follow-up request can test how much the appearance depends on the intervals:
Compare $2, $5, and $10 bin widths using the same bill amounts. Start every set of bins at zero, cover the full dataset, and use the same horizontal display range. Label the bin width and observation count on each chart.
The notebook keeps the data checks, bin definitions, and calculations alongside the charts. If you need help choosing a different view, describe the question in Deepnote’s AI chart generator.
Make a histogram in Excel
Deepnote offers a more direct workflow when you want to check the observations, compare bin widths, and calculate summaries together. If your measurements are already in an Excel workbook, you can also use its built-in histogram chart.
Place the individual numerical observations in one column, select the values, and choose the Histogram option under Insert, Statistic Chart.
You can adjust the bin width or number of bins using the horizontal axis settings.
Make sure the selected data contain individual measurements rather than a precomputed summary table. Also review any overflow or underflow bin settings, since they affect how extreme values are grouped.
Common mistakes when making histograms
Choosing bins without checking alternatives
A single bin width may hide peaks, exaggerate small fluctuations, or obscure gaps.
Compare a few reasonable widths using consistent boundaries before deciding which chart best represents the distribution.
Comparing histograms with different scales
Two histograms may have different sample sizes or bin widths.
If you compare raw counts, the larger sample may naturally produce taller bars. If the bin widths differ, their heights may not be directly comparable either.
Use aligned bins and appropriate normalization when comparing distribution shapes across groups.
Treating apparent outliers as errors
An isolated bar at the end of a distribution is a reason to inspect the observations. It does not prove that the data are incorrect.
Check whether extreme values reflect legitimate events, data-entry problems, or a different population.
Ignoring how the data was collected
A histogram describes the observations available to us. It does not guarantee that they represent a wider population.
A sample containing only weekday transactions, for example, may give an incomplete view of customer spending patterns across the full week.
Always consider the sampling process before drawing broader conclusions.
Losing the differences between groups
A combined histogram can obscure variation among meaningful subgroups.
If a distribution contains multiple peaks or an unexpectedly wide spread, examine whether grouping by product, region, customer segment, or another relevant variable changes the interpretation.