The same plot in 14 other libraries — Python: Altair, Bokeh, lets-plot, Matplotlib, Plotly, plotnine, Pygal, Seaborn; Julia: Makie.jl; JavaScript: Chart.js, D3.js, Apache ECharts, Highcharts, MUI X Charts. Compare all 15 side by side: Route Path Map in Python, R, Julia and JavaScript.
A geographic map visualization showing a connected path or route between sequential waypoints. Unlike scatter maps that display discrete points, this plot connects coordinates in order to reveal journeys, tracks, and navigation paths. Ideal for GPS data, delivery routes, and travel visualization where the sequence and continuity of movement matters.

#' anyplot.ai
#' map-route-path: Route Path Map
#' Library: ggplot2 3.5.1 | R 4.4.1
#' Quality: 85/100 | Created: 2026-05-21
library(ggplot2)
library(ragg)
set.seed(42)
# Theme tokens
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 <- c("#009E73", "#C475FD", "#4467A3", "#BD8233",
"#AE3030", "#2ABCCD", "#954477")
GRID_COLOR <- if (THEME == "light") INK_SOFT else "#3A3A36"
# Data: Synthetic GPS track for a mountain trail in Colorado Rockies
n_points <- 200
t <- seq(0, 2 * pi, length.out = n_points)
lon <- -105.6500 +
0.085 * (t / (2 * pi)) +
0.011 * sin(t * 2.5) +
rnorm(n_points, 0, 0.0005)
lat <- 40.4100 +
0.018 * sin(t * 1.1) +
0.007 * cos(t * 3.5) +
rnorm(n_points, 0, 0.0005)
# Elevation: classic ascent-peak-descent profile with realistic GPS noise
elevation <- 3100 +
600 * sin(seq(0, pi, length.out = n_points)) +
85 * sin(seq(0, 8 * pi, length.out = n_points)) +
rnorm(n_points, 0, 22)
df <- tibble::tibble(
lon = lon,
lat = lat,
sequence = seq_len(n_points),
elevation = elevation
)
# Endpoint markers (start = circle, end = square)
endpoints <- tibble::tibble(
lon = c(df$lon[1], df$lon[n_points]),
lat = c(df$lat[1], df$lat[n_points]),
role = factor(c("Start", "End"), levels = c("Start", "End"))
)
# Plot
p <- ggplot(df, aes(x = lon, y = lat)) +
geom_path(
aes(color = elevation),
linewidth = 2.0,
lineend = "round",
linejoin = "round"
) +
geom_point(
data = endpoints,
aes(shape = role, fill = role),
size = 6.5,
color = PAGE_BG,
stroke = 1.8
) +
scale_color_viridis_c(
option = "viridis",
name = "Elevation (m)",
guide = guide_colorbar(
barwidth = 0.6,
barheight = 7,
title.position = "top"
)
) +
scale_fill_manual(
values = c("Start" = IMPRINT[1], "End" = IMPRINT[2]),
name = NULL
) +
scale_shape_manual(
values = c("Start" = 21, "End" = 22),
name = NULL
) +
coord_fixed(ratio = 1.31) +
labs(
title = "Rocky Mountain Trail · map-route-path · r · ggplot2 · anyplot.ai",
x = "Longitude",
y = "Latitude"
) +
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.border = element_blank(),
panel.grid.major = element_line(color = GRID_COLOR, linewidth = 0.10),
panel.grid.minor = element_blank(),
axis.line = element_line(color = INK_SOFT, linewidth = 0.5),
axis.title = element_text(color = INK, size = 10),
axis.text = element_text(color = INK_SOFT, size = 8),
plot.title = element_text(color = INK, size = 12),
legend.background = element_rect(fill = ELEVATED_BG, color = INK_SOFT, linewidth = 0.3),
legend.text = element_text(color = INK_SOFT, size = 8),
legend.title = element_text(color = INK, size = 10),
legend.key = element_rect(fill = PAGE_BG, color = NA),
legend.margin = margin(5, 8, 5, 8),
plot.margin = margin(10, 15, 10, 10, unit = "pt")
)
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/map-route-path/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": "map-route-path",
"language": "r",
"library": "ggplot2",
"page": "https://anyplot.ai/map-route-path/r/ggplot2",
"hub": "https://anyplot.ai/map-route-path",
"code_json": "https://api.anyplot.ai/specs/map-route-path/ggplot2/code",
"spec_json": "https://api.anyplot.ai/specs/map-route-path",
"render_light_png": "https://storage.googleapis.com/anyplot-images/plots/map-route-path/r/ggplot2/plot-light.png",
"render_dark_png": "https://storage.googleapis.com/anyplot-images/plots/map-route-path/r/ggplot2/plot-dark.png",
"quality_score": 85.0,
"license": "MIT",
"guide": "https://anyplot.ai/llms.txt"
}Part of Route Path Map on anyplot.ai.