ComparisonBeginner

Bar Chart

A chart that uses rectangular bars to represent data values — the longer the bar, the greater the value. The most versatile and widely used chart in data visualization, with a 240-year track record and a place in every spreadsheet, BI tool, and plotting library.

// 01The chart

What it looks like

Example — Monthly website visitors by channelJan – Jun 2025
50k40k30k20k10k018kJan26kFeb22kMar38kApr44kMay+73% vs Jan

A vertical bar chart comparing monthly visitor counts. The highlighted bar (March) draws attention to a specific data point.

// 02Definition

What is a bar chart?

A bar chart (also called a bar graph) is one of the oldest and most intuitive ways to display data. It uses rectangular bars — either horizontal or vertical — to represent values for different categories. The length or height of each bar is proportional to the value it represents: a longer bar means a bigger number.

When the bars are vertical (standing upright), it’s technically called a column chart, though both terms are used interchangeably in everyday language. When bars run horizontally, they’re especially good for long category names that would be hard to read on a vertical axis.

Bar charts excel at one specific job: comparison. They let your eye instantly judge which category is largest, which is smallest, and how they rank relative to each other. The encoding is direct: the position of each bar’s end on the value axis is the value, and humans are unusually good at comparing lengths along a common baseline. That’s why bar charts beat pie charts for almost every part-to-whole question, why they beat 3D charts for almost every comparison question, and why they keep showing up everywhere from spreadsheets to scientific journals.

The price of that simplicity is rigidity: bar charts only work when your data fits a small set of categories with a single numeric value per category. Stretch them outside that shape and they get worse fast. The rest of this guide is about how to live inside the bar chart’s sweet spot — and how to recognize when you’ve walked outside it.

Origin: The bar chart was invented by Scottish engineer and political economist William Playfair in 1786. He used it in his landmark work The Commercial and Political Atlas to show trade data between Scotland and other nations — over 240 years ago.

// 03When to use

When a bar chart is the right call

Reach for a bar chart whenever the question is about comparison across discrete things and the answer is a single number per thing. Below are the situations where it consistently wins against the alternatives.

✓Use a bar chart when…
  • Comparing values across a discrete set of categories (countries, products, teams)
  • Your data has fewer than ~15–20 categories
  • You want your audience to immediately see which category is largest or smallest
  • Category names are long — use horizontal bars so text reads left-to-right
  • Showing rankings, survey results, or performance benchmarks
  • The zero baseline is meaningful and values don’t span a huge range
  • You need the chart to work in print, on mobile, and in a screen reader — bar charts degrade well

// 04When not to use

When a bar chart is the wrong call

A bar chart can technically display almost any data, but “technically possible” is not the same as “good idea.” Below are the cases where the bar chart actively hides information you need to communicate.

×Avoid a bar chart when…
  • You want to show change over continuous time — use a line chart instead
  • You have more than 20 categories, which becomes too dense to read
  • You need to show proportions of a whole — use a pie or stacked bar chart for ratios
  • You’re comparing two continuous variables — use a scatter plot
  • Your data has a natural order but varying intervals (age groups with unequal widths)
  • All values are nearly identical — differences will be invisible
  • The value axis cannot start at zero — use a dot plot or lollipop chart instead
  • You need to show distributions of a continuous variable — use a histogram or density plot

// 05Data requirements

What your data needs to look like

Before building the chart, your dataset needs to fit a specific shape. Use this checklist to confirm yours does.

Shape

One row per category, with a numeric value column. Optionally a second category column for grouping or stacking.

Minimum rows

2 categories. With one row there is nothing to compare.

Maximum rows

~20 categories. Past that, bars get too thin and labels overlap.

Required fields
categoryrequired
string / categorical

A label for each bar. Categories should be discrete and non-overlapping — country names, product SKUs, survey options, departments. Avoid free-text labels that vary across rows.

valuerequired
number (continuous)

The quantity each bar encodes. Must share a single unit across rows (dollars, percent, count). Negative values are allowed but are usually rendered as a separate “diverging” bar chart variant.

group
string (optional)

Optional second category used to split each bar into a grouped or stacked bar chart. Keep the number of groups to 2–4 to stay readable.

highlight
boolean (optional)

Optional flag used to draw attention to one or two bars with the accent color. Useful for callouts but never required.

Example data
channelvaluehighlight
Direct18,400false
Organic44,120true
Referral9,800false
Email12,300false
Paid14,900false
Social7,200false

Tip: if your raw data is a long list of events, aggregate it first. Bar charts plot summarized values, not raw rows. Tools like Excel’s pivot tables, SQL GROUP BY, or pandas .groupby().sum() are how you get from rows to chart-ready data.

// 06Anatomy

Parts of a bar chart

Every bar chart is built from the same handful of parts. Knowing the names makes it easier to talk about what to keep, what to drop, and what most templates are getting wrong.

ABCD7550250ABCDE
A — Y-axis (value axis): The vertical axis showing the numeric scale of values
B — X-axis (category axis): The horizontal axis listing each category being compared
C — Bar height: The most important visual element — its length encodes the data value
D — Gridlines: Horizontal reference lines that help the eye read bar heights accurately
E — Baseline (zero line): Must always start at zero so bar lengths accurately represent values

// 07Step-by-step

Step-by-step: how to build a good bar chart

A nine-step recipe that works regardless of the tool. Walk through it the first few times and the moves become automatic; skip steps and the chart usually shows it.

  1. 1

    Pick the question you want the chart to answer

    A bar chart answers “which category is biggest, smallest, or how do they rank?” Write that question down before you draw anything. If your question is about change over time, correlation, or a share of a whole, switch to a different chart now — not after you have built it.
  2. 2

    Shape the data into category + value pairs

    Aggregate the raw data so you have one row per category and one numeric value per row. Drop or merge any categories with vanishing values into an “Other” bucket so the chart stays readable.
  3. 3

    Sort the categories

    Sort by value descending unless the categories have an inherent order (months, age groups, survey options). Sorted bars turn the chart into an instant ranking; arbitrary order forces the reader to scan the entire chart.
  4. 4

    Choose the orientation

    Use vertical bars for short labels and time-like sequences. Use horizontal bars when category names are long, when you have more than ~7 categories, or when sorted ranking is the headline.
  5. 5

    Lock the value axis to zero

    Bar length is the encoding. A non-zero baseline visually multiplies small differences and breaks the ratio between bars. If your data forces a non-zero baseline (temperatures around freezing, for example), use a dot plot or lollipop chart instead.
  6. 6

    Format the axes and labels

    Use the actual category names instead of letter codes. Format the value axis with consistent units, sensible tick spacing, and a thousands separator. Drop the chart border and any heavy gridlines.
  7. 7

    Choose color with intent

    Default to a single neutral color for all bars. If you want to call out a specific bar, paint just that one with the accent color. Reserve multi-color schemes for when color encodes a real second variable.
  8. 8

    Add a title that states the takeaway

    “Monthly visitors by channel, Jan–Jun 2025” is a label. “Organic search drove 3× more visitors than paid this spring” is a takeaway. Lead with the takeaway and put the descriptive label as a subtitle.
  9. 9

    Annotate, then ship

    Highlight the bar your title is about, add a small caption with the source and date, and verify the chart still works at the size your readers will see it (mobile column, dashboard tile, slide deck).

// 08Real-world examples

Where you’ll see bar charts used

Bar charts show up in three places more than anywhere else: business dashboards, news graphics, and scientific papers. Each context has its own conventions, and they all reward the same fundamentals.

01

Business: Sales performance by region

A sales dashboard comparing revenue across 8 regional offices. Bars are sorted from highest to lowest so leadership can instantly see which regions are outperforming and which need attention. The company average is shown as a reference line, and the lowest two regions are tinted red. Reviewers can answer “who needs help this quarter?” in seconds.

Business Analytics
02

Journalism: Election results by candidate

A horizontal bar chart published by a news outlet showing vote share for 12 candidates in a primary election. Horizontal orientation allows full candidate names to be readable alongside each bar. Color differentiates party affiliation, and the chart is sorted by vote share so the leading candidate sits at the top.

Data Journalism
03

Science: Survey responses by age group

A research paper comparing agreement rates to a survey question across six age brackets. The bars are ordered by age group (not value) because the sequence is meaningful — the reader can immediately see how opinion shifts with age. Confidence intervals appear as small whiskers on top of each bar.

Research
04

Product: Feature adoption

A product manager tracks adoption of new features across the last release. A horizontal bar chart with one bar per feature, sorted by adoption rate, surfaces the winners and the laggards. Dotted reference lines mark the team’s 25% and 50% adoption targets.

Product Analytics

// 09Variations

Types of bar charts

The basic bar chart has several important variants, each suited to slightly different data situations. The headline rule is the same as ever: pick the variant whose strengths match your question.

Grouped bar chart

Places bars for multiple sub-categories side by side within each main category. Use when comparing groups across the same categories.

Stacked bar chart

Stacks sub-categories within each bar to show both the total and individual component contributions simultaneously.

Horizontal bar chart

Rotates bars to run left-to-right. Ideal when category names are long text labels that would overlap vertically.

Lollipop chart

Replaces each bar with a thin line and a dot. Reduces visual clutter when showing many categories, keeping the comparison clear.

// 10Comparisons

Bar chart vs other chart types

Bar charts get confused with several other chart types because they all use rectangles. The differences matter — picking the wrong one changes what your reader is allowed to conclude.

Bar chart vs column chart

These are the same chart with different orientations: bar charts run horizontally, column charts run vertically. Pick the orientation that fits your labels and your reading order, not based on a strict rule.

Bar chart (horizontal)

Bars run left-to-right. Categories sit on the vertical axis, values on the horizontal axis. Best when labels are long or you want a clean ranking.

  • Long category names read naturally
  • Sorted ranking reads top-down like a list
  • Holds 12–20 categories before crowding

Column chart (vertical)

Bars run bottom-to-top. Categories sit on the horizontal axis, values on the vertical axis. Best for short labels and sequences with an implied left-to-right order.

  • Reads naturally for time-like sequences
  • Compact in narrow dashboard tiles
  • Common default in spreadsheets

Bar chart vs histogram

Bar charts and histograms look similar but answer different questions. A bar chart compares discrete categories; a histogram shows the distribution of one continuous variable. The visual giveaway is whether the bars touch.

Bar chart

Each bar represents a separate, unrelated category. Bars have gaps to communicate that the categories are distinct. The order can be changed.

  • Categories are nominal or ordinal
  • Bars are usually drawn with gaps
  • Can be sorted by value or by category

Histogram

Each bar represents a bin of a continuous variable. Bars touch to show that the underlying scale is continuous. The bin order is fixed by the scale.

  • Variable is continuous (numeric)
  • Bars are drawn flush with no gaps
  • Order is fixed; you can’t resort bins

Horizontal vs vertical orientation

Same chart, different visual ergonomics. Choose the orientation that matches your labels, your screen real estate, and the reading direction your audience expects.

Horizontal bars

Default for long labels, large category counts, and ranked lists. The reader’s eye travels top-to-bottom like reading a list.

  • Use when labels exceed ~12 characters
  • Use when ranking is the headline
  • Use when you have more than ~7 categories

Vertical bars (columns)

Default for short labels and sequences with a natural left-to-right order, like months of the year or quarterly results.

  • Use for short, fixed-length labels
  • Use when categories form a sequence
  • Use in narrow dashboard tiles

Grouped vs stacked bars

Both add a second category to a bar chart, but they answer different questions. Grouped bars compare sub-categories within each group; stacked bars compare totals while showing how each total breaks down.

Grouped bars

Sub-categories sit side by side inside each main category. Use when comparing each sub-category across groups is the main question.

  • Easy to compare sub-categories
  • Hard to compare totals
  • Best with 2–3 sub-categories per group

Stacked bars

Sub-categories stack inside each bar. Use when comparing totals matters and you want to show composition.

  • Easy to compare totals
  • Only the bottom segment is easy to compare across bars
  • Switch to 100% stacked for share-of-total

// 11Common mistakes

Mistakes to watch out for

Almost every broken bar chart in the wild fails the same handful of ways. If you only memorize five rules, make them these.

Truncated Y-axis (not starting at zero)

This is the most common and most misleading mistake. When the axis starts at, say, 80 instead of 0, a bar that represents 85 will look enormous compared to one representing 82 — even though the actual difference is tiny. Bar charts must always start at zero because the human eye reads bar length, not bar position.

Too many categories

Once you exceed 15–20 bars, the chart becomes hard to parse. Individual bars get thin, labels overlap, and the visual comparison breaks down. If you have many categories, consider grouping smaller ones into “Other,” using a lollipop chart, or splitting into small multiples.

Unsorted bars without a reason

Random ordering makes patterns hard to spot. In most cases, sort bars by value (descending) to make ranking instantly clear. Only keep category-defined order if the sequence itself is meaningful — like months of the year.

3D bars or visual effects

Three-dimensional bars look flashy but make it harder to judge bar height accurately. The depth effect creates an optical illusion where bars appear taller or shorter than they are. Stick to flat, 2D bars.

Overloading with color

Using a different color for every bar adds visual noise without adding information. Color should encode meaning — like highlighting the category with the highest value, or grouping bars by a second variable. A single accent color on one bar draws the eye far more effectively than a rainbow.

Stacked bars with too many segments

Stack three or four segments at most. Past that, the only segment readers can compare reliably is the one anchored to the baseline; the rest float on top of variable amounts of color and become impossible to rank across bars.

Pie-chart-style data crammed into bars

A bar chart where every bar represents a share of the same total often wants to be a 100% stacked bar chart or a single chart with the totals labeled. If your bars literally always sum to 100%, you’re showing parts of a whole.

// 12Accessibility

Accessibility checklist

Run through this list before publishing. The chart should still communicate its message to readers using assistive technology, color-blind users, keyboard navigation, and reduced-motion settings.

  • ✓

    Color contrast meets WCAG AA

    WCAG 1.4.3
    Bar fill against the chart background should reach at least 3:1 contrast for graphical objects, and any text labels (titles, axes, callouts) should reach 4.5:1 for body text or 3:1 for large text.
  • ✓

    Do not rely on color alone

    WCAG 1.4.1
    If color is encoding a second variable (group, status, sentiment), reinforce it with a pattern, a direct label, or a clearly different shape. Roughly 1 in 12 men and 1 in 200 women have some form of color-vision deficiency.
  • ✓

    Provide a text alternative for the chart

    WCAG 1.1.1
    Add an accessible name (alt text or aria-label) that summarizes the takeaway, not the type of chart. “Bar chart of monthly visitors” is weak; “Monthly visitors rose from 18k in January to 44k in May, with March showing a dip to 22k” is strong.
  • ✓

    Expose the underlying data

    WCAG 1.3.1
    Place the raw values in a screen-reader-friendly table next to or beneath the chart, or expose them via a hidden table that screen readers can navigate. Many readers will copy this data rather than re-key it from the visual.
  • ✓

    Keep tooltip content keyboard-accessible

    WCAG 2.1.1
    If the chart is interactive, every bar should be reachable with the Tab key and its tooltip should appear on focus, not only on hover. The interactive elements should also have a visible focus ring.
  • ✓

    Respect prefers-reduced-motion

    WCAG 2.3.3
    If bars animate in on load, gate the animation behind a prefers-reduced-motion: no-preference media query so motion-sensitive readers see the final state immediately.
  • ✓

    Make the chart resizable and zoomable

    WCAG 1.4.4
    Let the chart container scale with the viewport and stay legible at 200% browser zoom. Avoid baking the SVG to a fixed pixel size; use a responsive viewBox.
  • ✓

    Label the value axis with units

    WCAG 3.3.2
    “1.2k” is fine in display, but the axis title or a nearby caption must state the unit (“unique visitors per month”) so a reader who can’t see the chart still understands what is being measured.

// 13Best practices

Design and craft tips

The mistakes section above tells you what to avoid. The list below is the positive version: the small set of habits that separate a good bar chart from a passable one.

Do

Sort bars by value

Default to descending order so the chart reads as a ranking. Keep categorical order only when the sequence carries meaning (months, age groups, Likert responses).
×Don’t

Crop the value axis

Never start the value axis above zero. Cropped baselines visually exaggerate small differences — a 5% gap can look like a doubling.
Do

Use a single neutral color

Paint every bar the same neutral color and use one accent color to call out the bar your headline is about. Color should add information, not noise.
×Don’t

Use 3D, gradients, or drop shadows

Decorative effects shift the perceived height of each bar by a few pixels and undermine the only thing the bar is doing: encoding a value with its length.
Do

Label long axes directly

If category names exceed ~12 characters, switch to horizontal bars so labels read left-to-right instead of being rotated 45°.
×Don’t

Show too many bars

Past about 20 bars, individual bars get too thin to compare and labels overlap. Group small categories into “Other,” switch to a lollipop chart, or break into small multiples.
Do

Lead with a takeaway title

Use the chart title to state the conclusion (“Organic drove 3× more visitors than paid”) and a smaller subtitle for the descriptive label (“Visitors by channel, Jan–Jun 2025”).
×Don’t

Stack more than ~4 segments per bar

Stacked bars with many segments make every segment except the bottom one hard to compare across bars. Keep stacks to 2–4 segments, or split into a 100% stacked variant.

// 15Tool instructions

How to build it in your tool of choice

The bar chart is the chart every tool ships with. The recipes below get you to a clean, sorted, zero-baseline bar chart in each of the most common platforms.

Microsoft Excel

Spreadsheet — ~3 min
  1. 01Place category labels in column A and numeric values in column B, with a header row.
  2. 02Highlight both columns including the headers.
  3. 03Open the Insert tab, choose Charts, then Clustered Column for vertical or Clustered Bar for horizontal.
  4. 04Right-click the data series and choose Sort to order bars by value (descending).
  5. 05Double-click the chart title and replace the default with a takeaway sentence.
  6. 06Format the value axis: ensure it starts at 0, remove unnecessary gridlines, and pick a sensible number format.

Tip: avoid the “3-D Bar” preset. Excel still ships it, but the perspective tilt makes it harder to compare bar lengths accurately.

Google Sheets

Spreadsheet — ~3 min
  1. 01Lay out your data with category labels in the first column and values in the second column.
  2. 02Select the range, then choose Insert → Chart.
  3. 03In the Chart editor on the right, set Chart type to Column chart (vertical) or Bar chart (horizontal).
  4. 04Open the Setup tab and confirm the data range and the column used as the X-axis.
  5. 05Switch to Customize → Vertical axis (or Horizontal axis for bar charts) and pin the Min to 0.
  6. 06Edit the chart title under Chart & axis titles → Chart title.

Sheets has no built-in sort-by-value option for charts. Sort the underlying data range first, then re-insert or refresh the chart.

Python (Matplotlib)

Code — ~5 min
  1. 01Install Matplotlib with pip install matplotlib if it isn’t already in your environment.
  2. 02Import matplotlib.pyplot as plt and create two parallel sequences: categories and values.
  3. 03Sort both sequences together by value before plotting (use sorted(zip(...))) so the chart is ranked.
  4. 04Call plt.bar(categories, values) for vertical bars or plt.barh(categories, values) for horizontal bars.
  5. 05Add plt.title(), plt.xlabel(), plt.ylabel() with units, and call plt.tight_layout() before plt.show() or plt.savefig().
  6. 06For accessibility, set color to a single neutral and pass a different color to specific bars to highlight them.

Use ax.spines[['top','right']].set_visible(False) to drop the chart border for a cleaner, publication-ready look.

R (ggplot2)

Code — ~5 min
  1. 01Install ggplot2 with install.packages('ggplot2') and load it with library(ggplot2).
  2. 02Build a data frame with two columns: a categorical column and a numeric value column.
  3. 03Reorder the categorical column with reorder(category, value) to sort bars by value.
  4. 04Pass the data frame to ggplot(), then add geom_col() (preferred over geom_bar() for pre-aggregated values).
  5. 05Apply coord_flip() if you want horizontal bars.
  6. 06Polish with labs() for the title and axis labels and theme_minimal() for a clean default look.

Use geom_col() not geom_bar() when your data already contains the value to plot. geom_bar() defaults to counting rows.

JavaScript (D3.js)

Code — ~10 min
  1. 01Install D3 (npm i d3) or include the CDN script tag in your HTML.
  2. 02Create an SVG container and set its width, height, and a margin object.
  3. 03Build a band scale for the category axis and a linear scale that starts at 0 for the value axis.
  4. 04Bind your data with selectAll('rect').data(data).join('rect') and set x, y, width, height from the scales.
  5. 05Render the axes with d3.axisBottom() and d3.axisLeft(), and append a title <text> element.
  6. 06Add a transition() with a duration() so bars animate in, but gate the animation behind prefers-reduced-motion.

If you don’t need full control, Chart.js, Recharts, Plotly, ECharts, or Observable Plot all get you to a working bar chart in fewer lines.

Tableau

BI — ~4 min
  1. 01Connect to your data source and drag the category dimension to the Rows shelf and the value measure to the Columns shelf for a horizontal bar chart.
  2. 02Tableau auto-selects the bar mark; if it doesn’t, change the Marks card to Bar.
  3. 03Click the value pill on Columns and choose Sort → Descending to rank bars.
  4. 04Right-click the value axis and choose Edit Axis to confirm it starts at 0 and uses fixed tick spacing.
  5. 05Drag the value measure onto the Label property in the Marks card to print exact values at the end of each bar.
  6. 06Use Format → Lines to remove unnecessary gridlines and zero lines, and edit the worksheet title.

Tableau’s default “Show Me” panel will offer both a horizontal bar and a vertical bar option — pick based on label length, not the visual you happen to see first.

Power BI

BI — ~4 min
  1. 01In Power BI Desktop, open the Visualizations pane and choose Stacked bar chart (horizontal) or Stacked column chart (vertical) — the default settings produce a basic bar chart with a single series.
  2. 02Drag your category field to the Y-axis (for bar) or X-axis (for column) well, and your value field to the Values well.
  3. 03Click the More options menu in the top-right of the visual and choose Sort by → your value field, descending.
  4. 04Open the Format pane, expand the value axis, and confirm the Start value is set to 0 (or Auto with a 0 minimum).
  5. 05Under Format → Data labels, toggle them on and choose Outside end so labels sit beyond the bar.
  6. 06Edit the title under Format → Title and write a takeaway sentence rather than the default field name.

If you need a true single-series chart and want to avoid the “stacked” wording, the same visual works — “stacked” simply means the visual supports a Legend field if you ever add one.

// 16Code examples

Working code in the most common stacks

Three runnable snippets that produce the same chart — a sorted, single-color bar chart with the largest bar highlighted in the brand accent. Copy, paste, and replace the data with yours.

bar_chart.py
import matplotlib.pyplot as plt

categories = ["Direct", "Organic", "Referral", "Email", "Paid", "Social"]
values = [18_400, 44_120, 9_800, 12_300, 14_900, 7_200]

# Sort by value, descending, so the chart reads as a ranking.
pairs = sorted(zip(values, categories), reverse=True)
values_sorted = [v for v, _ in pairs]
labels_sorted = [c for _, c in pairs]

# Highlight the largest bar with the brand accent color.
colors = ["#c94a2e" if c == labels_sorted[0] else "#e8c4b8" for c in labels_sorted]

fig, ax = plt.subplots(figsize=(8, 4.5))
ax.bar(labels_sorted, values_sorted, color=colors, width=0.7)

# Always start the value axis at 0 for a bar chart.
ax.set_ylim(bottom=0)
ax.set_title("Monthly visitors by channel — May 2025", loc="left", fontsize=14)
ax.set_ylabel("Unique visitors")
ax.spines[["top", "right"]].set_visible(False)
ax.tick_params(axis="x", rotation=0)

# Print the value above each bar.
for bar, value in zip(ax.patches, values_sorted):
    ax.text(bar.get_x() + bar.get_width() / 2, value, f"{value:,}",
            ha="center", va="bottom", fontsize=10, color="#6b6b67")

plt.tight_layout()
plt.savefig("bar_chart.png", dpi=200)
plt.show()
$ python bar_chart.py

// 17 — FAQs

Frequently asked questions

What is a bar chart?+

A bar chart (also called a bar graph) is one of the oldest and most intuitive ways to display data. It uses rectangular bars — either horizontal or vertical — to represent values for different categories. The length or height of each bar is proportional to the value it represents: a longer bar means a bigger number.

When should you use a bar chart?+

Use a bar chart when comparing values across a discrete set of categories (countries, products, teams). It also works well when your data has fewer than ~15–20 categories, and when you want your audience to immediately see which category is largest or smallest.

When should you avoid a bar chart?+

Avoid a bar chart when you want to show change over continuous time — use a line chart instead. It is also a poor fit when you have more than 20 categories, which becomes too dense to read, or when you need to show proportions of a whole — use a pie or stacked bar chart.

What is the difference between a bar chart and a column chart?+

Functionally they are the same chart — both compare a numeric value across discrete categories using rectangular bars. The difference is orientation: a bar chart runs horizontally with bars going left-to-right, while a column chart runs vertically with bars going bottom-to-top. Choose horizontal bars for long category labels, vertical bars for time-like sequences such as months.

What is the difference between a bar chart and a histogram?+

A bar chart compares values across discrete, unrelated categories, so its bars are usually drawn with gaps between them. A histogram shows the distribution of a single continuous variable by grouping it into bins, so its bars touch to communicate that the underlying scale is continuous. Histograms cannot be reordered — the bin order carries meaning.

Does a bar chart axis need to start at zero?+

Yes, for a standard bar chart the value axis must start at zero. Bar length encodes the value, and a non-zero baseline visually distorts the ratios between bars — a small percentage difference can look like a doubling. If you cannot start at zero (for example, when comparing temperatures around freezing), use a dot plot or lollipop chart instead.

How many categories can a bar chart hold?+

A bar chart is comfortable up to about 12 categories and starts to break down beyond 20. Past that point, bars get too thin to compare, labels overlap, and the eye loses the ability to rank quickly. If you have more categories, group small ones into an “Other” bucket, switch to a lollipop chart, or break the data into small multiples.

Should bar chart bars be sorted?+

Almost always, yes. Sorting bars by value (descending) turns the chart into an instant ranking and lets the reader compare neighbors without scanning the whole chart. The exception is when the categories have an inherent order — like months, age groups, or survey response options — in which case you keep that order so the sequence carries meaning.

Can a bar chart show change over time?+

It can show a small number of time points (a month-by-month sales bar chart is common), but a line chart is almost always better for time series. Lines emphasize continuity and trend, while bars emphasize discrete comparisons. As a rule of thumb, prefer bars when your time axis has fewer than ~12 points and the focus is on comparing each point individually.

What category of chart is a bar chart?+

Bar Chart belongs to the Comparison family of charts. Charts in that family are designed to answer the same kind of question, so they often work as alternatives when one doesn’t quite fit your data.

How do you read a bar chart?+

Start with the title and axis labels, confirm that the value axis begins at zero, then look at the overall shape before zooming into individual bars. Compare the longest and shortest bars first, scan for outliers, and finally verify any conclusion against the underlying numbers when precision matters.

What’s the best library for building bar charts in code?+

For static, publication-quality bar charts, Matplotlib (Python) and ggplot2 (R) are the standard choices. For interactive web bar charts, D3.js gives the most control while Chart.js, Recharts, Plotly, and ECharts are higher-level alternatives that get you to a working chart in a handful of lines.

// 18References

References and further reading

Primary sources, reference texts, and the official documentation for the libraries and tools referenced throughout this guide.

  • Encyclopedia entry covering the history, variants, and visual encoding of bar charts. A solid neutral starting point with citations to primary sources.
    https://en.wikipedia.org/wiki/Bar_chart
  • Playfair’s original publication, where the bar chart first appeared as a way to visualize Scotland’s trade with other nations. Hosted by the Internet Archive.
    https://archive.org/details/PLAYFAIRWilliam1786TheCommercialandPoliticalAtlas
  • Tufte’s foundational text on data graphics. The chapters on chartjunk and data-ink ratio explain why plain bar charts beat decorated ones.
    https://www.edwardtufte.com/book/the-visual-display-of-quantitative-information/
  • Practical guide for everyday business charts. Several chapters cover sorting, labeling, and the takeaway-title pattern this guide recommends.
    https://www.storytellingwithdata.com/books
  • Hands-on tutorial with real published examples. Especially useful for sorting, labeling, and avoiding the truncated-axis trap.
    https://academy.datawrapper.de/article/68-what-to-consider-when-creating-bar-charts
  • Open-source poster categorizing chart types by intent (comparison, change over time, distribution, and more). Bar charts sit firmly in the Comparison family.
    https://github.com/Financial-Times/chart-doctor/tree/main/visual-vocabulary
  • Web Accessibility Initiative guidance on making charts accessible: text alternatives, long descriptions, and data tables. Use this when building the accessibility checklist.
    https://www.w3.org/WAI/tutorials/images/complex/
  • Official API reference for the Python bar chart helper used in this guide’s code sample.
    https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.bar.html
  • Tidyverse documentation for the ggplot2 column geometry. Explains the difference between geom_col and geom_bar and when to use each.
    https://ggplot2.tidyverse.org/reference/geom_bar.html
  • Maintained Observable notebook from the D3 team that mirrors the JavaScript code sample in this guide.
    https://observablehq.com/@d3/bar-chart/2