# Install packages
if (!requireNamespace("data.table", quietly = TRUE)) {
install.packages("data.table")
}
if (!requireNamespace("jsonlite", quietly = TRUE)) {
install.packages("jsonlite")
}
if (!requireNamespace("ggplot2", quietly = TRUE)) {
install.packages("ggplot2")
}
if (!requireNamespace("ggbump", quietly = TRUE)) {
install.packages("https://cran.r-project.org/src/contrib/Archive/ggbump/ggbump_0.1.0.tar.gz")
}
if (!requireNamespace("dplyr", quietly = TRUE)) {
install.packages("dplyr")
}
# Load packages
library(data.table)
library(jsonlite)
library(ggplot2)
library(ggbump)
library(dplyr)Bumpchart
Note
Hiplot website
This page is the tutorial for source code version of the Hiplot Bumpchart plugin. You can also use the Hiplot website to achieve no code ploting. For more information please see the following link:
Bump chart can be used to display the change of grouped values.
Setup
System Requirements: Cross-platform (Linux/MacOS/Windows)
Programming language: R
Dependent packages:
data.table;jsonlite;ggplot2;ggbump;dplyr
sessioninfo::session_info("attached")β Session info βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
setting value
version R version 4.5.2 (2025-10-31)
os Ubuntu 24.04.3 LTS
system x86_64, linux-gnu
ui X11
language (EN)
collate C.UTF-8
ctype C.UTF-8
tz UTC
date 2026-01-17
pandoc 3.1.3 @ /usr/bin/ (via rmarkdown)
quarto 1.8.27 @ /usr/local/bin/quarto
β Packages βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
package * version date (UTC) lib source
data.table * 1.18.0 2025-12-24 [1] RSPM
dplyr * 1.1.4 2023-11-17 [1] RSPM
ggbump * 0.1.99999 2025-12-23 [1] Github (davidsjoberg/ggbump@fe6d5c7)
ggplot2 * 4.0.1 2025-11-14 [1] RSPM
jsonlite * 2.0.0 2025-03-27 [1] RSPM
[1] /home/runner/work/_temp/Library
[2] /opt/R/4.5.2/lib/R/site-library
[3] /opt/R/4.5.2/lib/R/library
* ββ Packages attached to the search path.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Data Preparation
# Load data
data <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/bumpchart/data.json")$exampleData$textarea[[1]])
data <- as.data.frame(data)
# View data
head(data) x y group
1 2019 4 A
2 2020 2 A
3 2021 2 A
4 2019 3 B
5 2020 1 B
6 2021 4 B
Visualization
# Bumpchart
p <- ggplot(data, aes(x = x, y = y, color = group)) +
geom_bump(size = 1.5) +
geom_point(size = 5) +
geom_text(data = data %>% filter(x == min(x)),
aes(x = x - 0.1, label = group),
size = 5, hjust = 1) +
geom_text(data = data %>% filter(x == max(x)),
aes(x = x + 0.1, label = group),
size = 5, hjust = 0) +
theme_void() +
theme(legend.position = "none") +
scale_color_manual(values = c("#0571B0","#92C5DE","#F4A582","#CA0020"))
p
