A bump chart visualizes how rankings change over time by plotting rank positions and connecting them with lines. Unlike line charts that show values, bump charts focus specifically on ordinal rankings, making it easy to track position changes, overtakes, and rank stability across time periods.

#' anyplot.ai
#' bump-basic: Basic Bump Chart
#' Library: ggplot2 3.5.1 | R 4.4.1
#' Quality: 89/100 | Created: 2026-05-29
library(ggplot2)
library(ragg)
set.seed(42)
# Theme tokens (Imprint palette, theme-adaptive chrome)
THEME <- Sys.getenv("ANYPLOT_THEME", "light")
PAGE_BG <- if (THEME == "light") "#FAF8F1" else "#1A1A17"
ELEVATED_BG <- if (THEME == "light") "#FFFDF6" else "#242420"
INK <- if (THEME == "light") "#1A1A17" else "#F0EFE8"
INK_SOFT <- if (THEME == "light") "#4A4A44" else "#B8B7B0"
# Imprint palette (canonical order, hybrid-v3)
IMPRINT_PALETTE <- c(
"#009E73", # 1 brand green
"#C475FD", # 2 lavender
"#4467A3", # 3 blue
"#BD8233", # 4 ochre
"#AE3030", # 5 matte red
"#2ABCCD" # 6 cyan
)
# Data: F1 Championship Standings — Rounds 1-8
drivers <- c("Hamilton", "Verstappen", "Leclerc", "Norris", "Russell", "Perez")
standings <- data.frame(
race = rep(1:8, each = 6),
driver = factor(rep(drivers, times = 8), levels = drivers),
rank = c(
2, 1, 3, 5, 4, 6,
1, 2, 3, 5, 4, 6,
1, 2, 4, 3, 5, 6,
2, 1, 4, 3, 5, 6,
2, 1, 3, 4, 5, 6,
2, 1, 3, 4, 6, 5,
1, 2, 3, 4, 6, 5,
1, 2, 3, 5, 6, 4
)
)
# Visual storytelling: highlight the Hamilton/Verstappen championship battle
TOP_DRIVERS <- c("Hamilton", "Verstappen")
driver_alpha <- setNames(ifelse(drivers %in% TOP_DRIVERS, 1.0, 0.5), drivers)
driver_colors <- setNames(IMPRINT_PALETTE, drivers)
labels_end <- standings[standings$race == 8, ]
labels_end$x_label <- 8.35
# Softer grid via embedded alpha
GRID_COLOR <- adjustcolor(INK, alpha.f = 0.15)
# Plot
p <- ggplot(standings, aes(x = race, y = rank, color = driver, group = driver)) +
geom_line(aes(alpha = driver), linewidth = 1.4, lineend = "round", linejoin = "round") +
geom_point(aes(alpha = driver), size = 3.5) +
geom_text(
data = labels_end,
aes(x = x_label, label = driver, alpha = driver),
hjust = 0,
size = 3.5,
fontface = "bold"
) +
scale_y_reverse(
breaks = 1:6,
labels = c("1st", "2nd", "3rd", "4th", "5th", "6th"),
expand = expansion(add = 0.4)
) +
scale_x_continuous(
breaks = 1:8,
labels = paste0("R", 1:8),
expand = expansion(mult = c(0.03, 0.20))
) +
scale_color_manual(values = driver_colors) +
scale_alpha_manual(values = driver_alpha, guide = "none") +
labs(
title = "bump-basic · r · ggplot2 · anyplot.ai",
x = "Race Round",
y = "Championship Position"
) +
theme_minimal(base_size = 8) +
theme(
plot.background = element_rect(fill = PAGE_BG, color = PAGE_BG),
panel.background = element_rect(fill = PAGE_BG, color = NA),
panel.grid.major.y = element_line(color = GRID_COLOR, linewidth = 0.3),
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
axis.title = element_text(color = INK, size = 10),
axis.text = element_text(color = INK_SOFT, size = 8),
axis.line.x = element_line(color = INK_SOFT, linewidth = 0.3),
plot.title = element_text(color = INK, size = 12, face = "bold"),
legend.position = "none",
plot.margin = margin(t = 18, r = 48, b = 18, l = 12, unit = "pt")
)
# Save
ggsave(
filename = sprintf("plot-%s.png", THEME),
plot = p,
device = ragg::agg_png,
width = 8,
height = 4.5,
units = "in",
dpi = 400
)
Runnable source as JSON, for any HTTP client: https://api.anyplot.ai/specs/bump-basic/ggplot2/code. Any spec id and library id listed in llms-full.txt fit the same URL shape; every URL below is complete and callable.
{
"spec_id": "bump-basic",
"language": "r",
"library": "ggplot2",
"page": "https://anyplot.ai/bump-basic/r/ggplot2",
"hub": "https://anyplot.ai/bump-basic",
"code_json": "https://api.anyplot.ai/specs/bump-basic/ggplot2/code",
"spec_json": "https://api.anyplot.ai/specs/bump-basic",
"render_light_png": "https://storage.googleapis.com/anyplot-images/plots/bump-basic/r/ggplot2/plot-light.png",
"render_dark_png": "https://storage.googleapis.com/anyplot-images/plots/bump-basic/r/ggplot2/plot-dark.png",
"quality_score": 89.0,
"license": "MIT",
"guide": "https://anyplot.ai/llms.txt"
}Part of Basic Bump Chart on anyplot.ai.