Lollipop Charts and Cleveland Dot Plots in Matplotlib

Make horizontal and vertical lollipop charts in Matplotlib with hlines() and stem(), plus Cleveland dot plots for comparing several series.

To make a lollipop chart in Matplotlib, draw a line to each value with ax.hlines() and put a marker at its end with ax.plot(). For a vertical version, ax.stem() draws both in one call. A Cleveland dot plot is the same idea without the lines.

Quick Example

A horizontal lollipop chart, sorted by value, with a label on each point:

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

battery = pd.Series({
    "Aster 13": 17.5, "Birch Pro": 12.1, "Cedar Air": 19.2, "Dune X": 8.4,
    "Ember 14": 14.8, "Fjord Lite": 11.3, "Grove 16": 9.7, "Harbor S": 15.9,
    "Iris Flex": 13.4, "Juniper 15": 10.6,
}).sort_values()

fig, ax = plt.subplots(figsize=(8, 5.5))
ax.hlines(y=battery.index, xmin=0, xmax=battery, color="#9a8c98", linewidth=2)
ax.plot(battery, battery.index, "o", markersize=11, color="#4a4e69")

for name, hours in battery.items():
    ax.annotate(f"{hours:.1f}", (hours, name), xytext=(10, 0),
                textcoords="offset points", va="center", fontsize=9)

ax.set_xlim(0, battery.max() * 1.1)
ax.set_xlabel("Battery life (hours)")
ax.set_title("Laptop battery life in a video playback test", loc="left")
ax.spines[["top", "right"]].set_visible(False)
fig.tight_layout()
plt.show()

Horizontal lollipop chart of battery life for ten sample laptops, sorted from Cedar Air at 19.2 hours down to Dune X at 8.4

sort_values() sorts ascending, which puts the largest value at the top because the y-axis starts at the bottom. The offset in xytext is in points, so labels stay the same distance from the markers whatever the data scale. See annotating data points for more labeling options.

Vertical Lollipop Chart with stem()

ax.stem() returns three objects: the markers, the stem lines, and a baseline. Style each with plt.setp():

months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
          "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
rides = [210, 260, 420, 610, 840, 930, 990, 950, 760, 540, 330, 190]

fig, ax = plt.subplots(figsize=(9, 4.5))
markerline, stemlines, baseline = ax.stem(months, rides)
plt.setp(markerline, markersize=12, color="#2a9d8f")
plt.setp(stemlines, color="#2a9d8f", linewidth=3)
baseline.set_visible(False)
ax.set_ylim(0, 1100)
ax.set_ylabel("Bike rides")
ax.set_title("Monthly rides, vertical lollipop chart", loc="left")
ax.spines[["top", "right"]].set_visible(False)
fig.tight_layout()
plt.show()

Vertical lollipop chart of monthly bike rides, rising from January to a peak of 990 in July and falling to 190 in December

stem() also accepts orientation="horizontal". It styles all stems together, so use hlines() or vlines() when each one needs its own color.

Color Lollipops Above and Below a Target

Start the lines at a reference value instead of zero, and pass a list of colors. This reuses the battery data:

target = 14
diff = battery - target
colors = np.where(diff >= 0, "#1b998b", "#d1495b")

fig, ax = plt.subplots(figsize=(8, 5.5))
ax.hlines(y=battery.index, xmin=target, xmax=battery, color=colors, linewidth=3)
ax.scatter(battery, battery.index, s=120, color=colors, zorder=3)
ax.axvline(target, color="black", linewidth=1)

for name, hours in battery.items():
    right = hours >= target
    ax.annotate(f"{hours - target:+.1f}", (hours, name),
                xytext=(10 if right else -10, 0), textcoords="offset points",
                ha="left" if right else "right", va="center", fontsize=9)

ax.set_xlim(6.5, 21.5)
ax.set_xlabel("Battery life (hours)")
ax.set_title(f"Hours above or below a {target} hour target", loc="left")
ax.spines[["top", "right"]].set_visible(False)
fig.tight_layout()
plt.show()

Diverging lollipop chart around a 14 hour target, with four laptops above in teal and six below in red

ax.scatter() is used for the markers here because it takes one color per point. zorder=3 draws them above the reference line.

Cleveland Dot Plot for Several Series

A dot plot places one marker per series on each row, with a faint grid line to guide the eye. Different marker shapes keep the series distinct without relying on color alone.

scores = pd.DataFrame(
    {
        "2024": [71, 64, 82, 58, 76, 69, 61],
        "2025": [74, 73, 84, 66, 75, 80, 63],
        "2026": [79, 78, 85, 75, 77, 86, 66],
    },
    index=["Onboarding", "Search", "Checkout", "Support", "Billing",
           "Mobile app", "Reporting"],
).sort_values("2026")

fig, ax = plt.subplots(figsize=(8, 5))
for year, color, marker in [("2024", "#c9ada7", "o"), ("2025", "#e09f3e", "s"),
                            ("2026", "#540b0e", "D")]:
    ax.plot(scores[year], scores.index, marker, markersize=9, color=color, label=year)

ax.grid(axis="y", color="#dddddd", linewidth=0.8)
ax.set_axisbelow(True)
ax.tick_params(axis="y", length=0)
ax.spines[["top", "right", "left"]].set_visible(False)
ax.set_xlim(55, 90)
ax.set_xlabel("Satisfaction score")
ax.set_title("Satisfaction by product area", loc="left", pad=28)
ax.legend(ncols=3, loc="lower left", bbox_to_anchor=(0, 1), frameon=False,
          handletextpad=0.2)
fig.tight_layout()
plt.show()

Cleveland dot plot of satisfaction scores for seven product areas in 2024, 2025 and 2026, led by Mobile app at 86 in 2026

Support and the mobile app improved the most from 2024 to 2026, by 17 points each. Billing moved only 1 point and dipped in 2025. With exactly two values per row, a dumbbell plot connects them and makes the change easier to see.

Lollipop Chart vs Bar Chart vs Dot Plot

fig, axes = plt.subplots(1, 3, figsize=(11, 4), sharey=True)
top = scores["2026"]

axes[0].barh(top.index, top, color="#335c67")
axes[0].set_title("Bar chart")
axes[1].hlines(top.index, 0, top, color="#335c67", linewidth=1.5)
axes[1].plot(top, top.index, "o", markersize=9, color="#335c67")
axes[1].set_title("Lollipop chart")
axes[2].plot(top, top.index, "o", markersize=9, color="#335c67")
axes[2].grid(axis="y", color="#dddddd")
axes[2].set_title("Dot plot")

for ax in axes[:2]:
    ax.set_xlim(0, 95)
axes[2].set_xlim(60, 90)
for ax in axes:
    ax.set_axisbelow(True)
    ax.spines[["top", "right"]].set_visible(False)
    ax.set_xlabel("2026 score")
fig.tight_layout()
plt.show()

The same seven scores as a bar chart, a lollipop chart and a dot plot; the dot plot's axis starts at 60, spreading the points apart

Chart Use when Axis must start at zero?
Bar chart A few categories, and the familiar form is best Yes
Lollipop chart Many categories, where solid bars feel heavy Yes, since line length encodes the value (or a stated target)
Dot plot Comparing close values or several series No, because position encodes the value. Label the axis clearly

Similar Topics