Deepnote research: our notes on building agents
Get started
← Back to all posts

Histogram vs bar graph: differences, examples, and when to use each

By Srihari Thyagarajan•

Updated on August 25, 2026

Learn the difference between a histogram and a bar graph using the same dataset, with examples showing how grouping changes the question each chart answers.

Illustrative image for blog post

Histograms and bar graphs both use bars, so it is easy to mistake one for the other.

The easiest way to separate them is to think about what each bar represents.

A bar graph compares separate groups. You might use one to compare sales across stores or votes for different candidates.

A histogram groups numbers into ranges. For example, if you recorded how long 500 food deliveries took, a histogram could show how many took 0 to 10 minutes, 10 to 20 minutes, 20 to 30 minutes, and so on.

That spread of values is what people mean by a distribution.

You may also see this comparison described as histogram vs. bar chart. In this guide, bar chart and bar graph mean the same thing.

Histogram vs bar graph: key differences and examples

Bar graphHistogram
What each bar representsOne categoryOne numerical interval
Typical inputA category and a measureOne numerical observation per row
OrderPreserve meaningful category order; otherwise, categories may be sortedIntervals must remain in numerical order
Bar spacingUsually separatedUsually touching
Use it toCompare categoriesExamine a distribution

Histogram vs bar graph: the same data, two questions

The charts below use a simulated dataset of 1,000 app requests. A request is simply one time that a part of an app was asked to do something.

Each row records the service that handled the request, such as Search or Payments, and its response time in milliseconds (ms). Grouping the rows by service shows how many requests each service handled; grouping the response times into intervals shows their distribution.

All values are synthetic and exist only to demonstrate the two charts.

Here are the first eight rows of the dataset. Each row represents one request, and latency_ms records its response time in milliseconds.

Service Response time (latency_ms)
Analytics239
Search263
Analytics314
Payments217
Auth135
Analytics335
Analytics385
Analytics218

Download the complete dataset of 1,000 requests to reproduce both charts. Count the rows by service for the bar graph, or group latency_ms into 100 ms intervals for the histogram.

Bar graph: how many requests did each service handle?

Grouping all 1,000 requests by service gives the totals below. Each request contributes to exactly one service’s count.

ServiceRequests
Analytics257
Search282
Payments198
Auth263
Total1,000

Each bar shows the number of requests handled by one service. Search handled the most requests in this dataset, while Payments handled the fewest.

The x-axis contains categories, not numerical ranges. Search and Payments are names, so their position could change without changing what either bar means.

You can create this type of comparison with Deepnote’s bar graph maker.

Histogram: how common are fast and slow response times?

Now take those same 1,000 requests and group them by response time instead of service.

A histogram ignores the service names and groups the response time column, latency_ms, into bins, or consecutive numerical intervals. These bins are 100 ms wide. The notation [100, 200) includes 100 but excludes 200, so a response time of exactly 200 ms belongs to [200, 300).

Grouping the same response times into 100 ms intervals gives these counts. Each interval includes its lower boundary and excludes its upper boundary.

Response-time bin (ms)Requests
[0, 100)71
[100, 200)419
[200, 300)294
[300, 400)131
[400, 500)62
[500, 600)20
[600, 700)2
[700, 800)0
[800, 900)1
Total1,000

Most requests fall in the lower response-time ranges, while a few take much longer. The busiest interval is 100 to 200 ms. The longer response times form a right tail, the sparse stretch toward the high end of the chart.

These intervals must stay in numerical order. Keeping the empty [700, 800) interval shows that no requests fall in that range; removing it would interrupt the scale. Unlike service names in a bar graph, response-time intervals cannot be rearranged to rank their counts.

Deepnote's histogram maker can create the bins from raw numerical values, and you can adjust the binning afterward.

Both charts therefore count the same 1,000 requests. The bar graph groups them by service; the histogram groups them by response-time range.

How bin width changes a histogram

A histogram with 200 ms bins produces a coarser summary of the same observations:

Response-time bin (ms)Requests
[0, 200)490
[200, 400)425
[400, 600)82
[600, 800)2
[800, 1,000)1
Total1,000

The 100 ms view identifies [100, 200) as the busiest interval and shows the empty [700, 800) bin. The 200 ms view makes the broad concentration below 400 ms easier to scan but hides those details. Very narrow bins can emphasize random fluctuation; very wide bins can hide structure, so check whether the main pattern survives a reasonable change in width.

With equal-width bins, taller bars mean more observations. If the widths differ, use frequency density: divide each bin’s count by its width. The area of each bar then represents the count, so a wider interval does not appear more important simply because it covers more values.

What if the categories are numbers?

Numeric labels do not automatically make a chart a histogram. Ratings from 1 to 5 can be ordered categories, with one bar for each rating. Their order is meaningful and should be preserved even though the values act as labels.

By contrast, individual measurements such as response times belong on a numerical scale and can be grouped into intervals. Histograms can also summarize discrete numerical observations, such as tickets per customer, when the goal is to examine their distribution. Gaps alone do not determine the chart type.

Bar graph vs histogram: five rules for choosing

Start with what one row of your data represents, then decide what the reader needs to see.

Start with what one row of your data represents, then decide what the reader needs to see.

If...UseExample
Each bar should stand for a named groupBar graphRequests handled by each service
Each row is a measurement and you want its shape, spread, or tailHistogramHow long individual requests took
The values are numbers that act as labelsBar graph, in their natural orderRatings from 1 to 5
The sample is small enough to show every valueDot plotResponse times for 20 requests
You need to compare the spread of several groupsBox plot or separate histogramsResponse times for each service

When a bar graph misrepresents a distribution

The mean is the average response time; the median is the middle value after sorting. The 95th percentile is the time at or below which about 95% of requests fall. It helps describe the slower end of the service’s response times.

A separate bar graph could compare mean response time by service:

ServiceMean (ms)Median (ms)95th percentile (ms)
Auth138.3134232.9
Search199.3186331.6
Payments255.8244438.6
Analytics324.7307514.2

That chart would show that Analytics has the highest mean response time and Auth the lowest. It would not show the spread or right tail within each service. To compare several distributions compactly, use separate histograms or a box plot maker rather than reducing every service to one average.

Turning response times into labels such as “Fast,” “Acceptable,” and “Slow” can also be useful for an operations dashboard. The tradeoff is lost detail: 201 ms and 499 ms would belong to the same category, while 499 ms and 501 ms could fall on opposite sides of a threshold.

Can you turn a histogram into a bar graph?

Adding spaces between the bars does not change what the chart measures. A histogram still summarizes observations in ordered numerical intervals.

In our example, switching to a service comparison means grouping the source requests by service instead of response time. The resulting bar graph answers a different question. If you have only the finished histogram or its bin counts, you cannot recover the service totals without the original data.

Make a histogram or bar graph in Deepnote

In a Chart block, Chart AI can configure the visualization from a plain-English description. With the request data loaded, ask it to “Count requests by service” or “Show the distribution of latency_ms as a histogram.” Review the grouping, bin settings, and axis labels before sharing.

Deepnote Agent can prepare the source data in SQL or Python, run the calculations, and inspect the outputs. For example, ask it to check that both summaries account for all 1,000 requests. Run snapshots preserve the executed blocks and outputs for review.

If you already know which chart you need, the histogram and bar graph makers build one from pasted or uploaded data. If you have not chosen a chart type yet, upload your data to the AI chart generator, describe the question you want answered, and refine the chart it suggests.

For example:

Count the number of requests handled by each service.

Or:

Show the distribution of request response times as a histogram.

Frequently asked questions

01

What is the difference between a histogram and a bar graph?


02

Is a histogram a bar graph?


03

When should you not use a histogram?


04

Can a bar graph show numerical data?


05

Why do histogram bars touch, while bar graphs have gaps?


Srihari Thyagarajan

Technical Writer

Follow Srihari on Twitter, LinkedIn and GitHub

Blog

Illustrative image for blog post

How data teams are actually building the context layer

By Jakub Jurovych

•

Updated on September 1, 2026

Try Deepnote now

Get started – it’s free
Book a demo

Footer

Solutions

  • Notebook
  • Data apps
  • Machine learning
  • Data teams

Product

Company

Comparisons

Resources

Tools

Footer

  • Privacy
  • Terms

© 2026 Deepnote. All rights reserved.