Skip to content
svglikert

Likert diverging bars

How do agreement levels compare across survey items?

Demo data · seed 20261101 · 400 rows · default settings · 640 × 360SVG, lightSVG, darkDemo CSV

How to read it

  1. The centre of the chart is neutral: disagreement grows to the left, agreement to the right.
  2. Compare how far each bar reaches on each side.
  3. Read the order: items are ranked by net agreement.
  1. Callout 1: Centre: the neutral responses straddle zero.
  2. Callout 2: Right side: the share who agree.
  3. Callout 3: Left side: the share who disagree.

Watch out

  • Response categories are ordered but not evenly spaced, so a mean of codes can mislead.
  • Check the sample size per item before ranking small differences.

Defaults

Order
By net agreement
How rows or groups are ordered.
Also: As listed
Percent labels
On
Print each segment's share.

Pinned in the code

  • Shares are per item over its non-missing responses; response order comes from the dictionary's ordinal levels (default 5-point Strongly disagree … Strongly agree).
  • With an odd number of levels the middle level is neutral and is split half left, half right of zero, so bars centre on neutral (Robbins & Heiberger 2011).
  • Net agreement = agree shares − disagree shares (neutral excluded); items are ranked by it.
  • A selection adds a thin outlined bar under each item with the selected respondents' shares.
# Likert diverging bars — Codesplash Chart Lab (recipe "likert")
# controls: sort=net, labels=true
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

try:
    import codesplash as cs  # optional: the app's chart theme
except ImportError:
    cs = None
if cs:
    cs.use_codesplash(dark=False)
PALETTE = cs.palette(dark=False)["categorical"] if cs else plt.rcParams["axes.prop_cycle"].by_key()["color"]

df = pd.read_csv("likert-demo.csv", keep_default_na=False, na_values=[""])  # demo data (only empty cells are missing): Chart Lab → Code → Download demo CSV
df["Meaningful work"] = pd.Categorical(df["Meaningful work"].astype("string"), categories=["Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"])
df["Clear goals"] = pd.Categorical(df["Clear goals"].astype("string"), categories=["Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"])
df["Manager support"] = pd.Categorical(df["Manager support"].astype("string"), categories=["Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"])
df["Fair pay"] = pd.Categorical(df["Fair pay"].astype("string"), categories=["Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"])
df["Work–life balance"] = pd.Categorical(df["Work–life balance"].astype("string"), categories=["Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"])
df["Growth opportunities"] = pd.Categorical(df["Growth opportunities"].astype("string"), categories=["Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"])

ITEMS = ["Meaningful work", "Clear goals", "Manager support", "Fair pay", "Work–life balance", "Growth opportunities"]
LEVELS = ["Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"]  # response order from the data dictionary
COLORS = ["#c95443", "#da8477", "#ced1d6", "#6691ca", "#2a69b5"]  # disagree … neutral … agree
k = len(LEVELS)
mid = (k - 1) / 2  # with an odd number of levels the middle one is neutral
shares = {}
for item in ITEMS:
    s = df[item].dropna().astype(str)
    s = s[s.isin(LEVELS)]
    shares[item] = s.value_counts().reindex(LEVELS, fill_value=0) / max(len(s), 1)  # share of non-missing responses
shares = pd.DataFrame(shares).T * 100  # items × levels, percent
neg = shares[[l for j, l in enumerate(LEVELS) if j < mid]].sum(axis=1)
pos = shares[[l for j, l in enumerate(LEVELS) if j > mid]].sum(axis=1)
neutral = shares[[l for j, l in enumerate(LEVELS) if j == mid]].sum(axis=1)
net = pos - neg  # net agreement
start = -(neg + neutral / 2)  # half the neutral share on each side of zero
order = list(net.sort_values(ascending=False, kind="stable").index)  # by net agreement

fig, ax = plt.subplots(figsize=(8, 4.5))
y = np.arange(len(order))[::-1]  # first item on top
for yi, item in zip(y, order):
    left = start[item]
    for j, lvl in enumerate(LEVELS):
        w = shares.loc[item, lvl]
        ax.barh(yi, w, left=left, color=COLORS[j], height=0.7, label=lvl if yi == y[0] else None)
        if w >= 6:
            ax.text(left + w / 2, yi, f"{w:.0f}", ha="center", va="center", fontsize=7)
        left += w
ax.axvline(0, color=plt.rcParams["axes.edgecolor"], linewidth=1)
ax.set_yticks(y, order)
ax.xaxis.set_major_formatter(lambda v, _: f"{abs(v):.0f}%")
ax.set_xlabel("Share of responses, centred on neutral (disagree left, agree right)")
ax.legend(ncol=k, loc="upper center", bbox_to_anchor=(0.5, -0.15), fontsize=8)
plt.show()

Needs pandas, numpy, matplotlib · reads likert-demo.csv · app theme from the optional codesplash helper