reglScatterplotR is an htmlwidgets interface to the JavaScript
regl-scatterplot library,
rendering millions of two-dimensional points in the browser via WebGL.
Built for exploratory visualisation of single-cell, spatial transcriptomics
and other high-dimensional biological data.

Python? A companion package, reglscatterpy, drives the same compiled widget from Python (AnnData / MuData / SpatialData) in Jupyter, VS Code and Colab — so plots look identical across the two languages.
RColorBrewer /
viridisLite palettes.SingleCellExperiment, SpatialExperiment, Seurat,
Monocle3, in-memory AnnData (anndataR / anndata), and plain matrices.IRkernel.# From GitHub (development version)
remotes::install_github("george123ya/reglScatterplotR")
# Once accepted into Bioconductor
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("reglScatterplotR")
library(reglScatterplotR)
# Plain data.frame
set.seed(1L)
df <- data.frame(
x = rnorm(20000),
y = rnorm(20000),
cluster = sample(letters[1:6], 20000, replace = TRUE),
score = runif(20000)
)
reglScatterplot(df, x = "x", y = "y", colorBy = "cluster")
reglScatterplot(df, x = "x", y = "y", colorBy = "score",
continuousPalette = "magma",
vmin = "p1", vmax = "p99")
# Ships with the package - no download needed
data(reglScatterExample)
reglScatterplot(reglScatterExample,
x = "UMAP_1", y = "UMAP_2", colorBy = "celltype")
reglScatterplot(reglScatterExample,
x = "UMAP_1", y = "UMAP_2", colorBy = "CD3D",
continuousPalette = "viridis", vmax = "p99")
library(SingleCellExperiment)
# sce already has reducedDim(sce, "UMAP") + colData(sce)$cluster
reglScatterplot(sce, x = "UMAP", colorBy = "cluster")
# Or colour by a gene
reglScatterplot(sce, x = "UMAP", colorBy = "MS4A1")
library(SpatialExperiment)
reglScatterplot(spe, x = "spatial", colorBy = "celltype",
autoFit = TRUE)
library(Seurat)
# seurat_obj already has an "umap" reduction + meta.data
reglScatterplot(seurat_obj, x = "umap", colorBy = "seurat_clusters")
# colorBy resolves meta.data columns OR features (via FetchData)
reglScatterplot(seurat_obj, x = "umap", colorBy = "MS4A1")
# In-memory AnnData from anndataR or the anndata package
library(anndataR)
ad <- read_h5ad("pbmc.h5ad")
reglScatterplot(ad, x = "umap", colorBy = "leiden") # obs column or a gene
# (AnnData read with zellkonverter::readH5AD() is an SCE - use x = "UMAP")
| Categorical colouring | Continuous (gene) colouring |
|---|---|
![]() |
![]() |
filterBy distribution sliders |
Synced plots (syncPlots) |
![]() |
![]() |
| Topic | Where |
|---|---|
| Tour with examples | vignette("reglScatterplot") |
| Scaling to millions of points | vignette("performance") |
| Wiki: extended recipes | https://github.com/george123ya/reglScatterplotR/wiki |
| Issue tracker | https://github.com/george123ya/reglScatterplotR/issues |
| Point count | Status | HTML size (typical) |
|---|---|---|
| ≤ 500 k | Flawless | < 5 MB |
| 500 k – 5 M | Smooth | 10 – 40 MB |
| 5 M – 20 M | Usable | 50 – 100 MB |
| > 20 M | Tile architecture territory | — |
The widget uses Uint16-quantised binary transfer, so a 1 M-point single-cell UMAP normally fits in a < 10 MB HTML file that you can email or commit.
citation("reglScatterplotR")
Please also cite the underlying JavaScript library: Lekschas, F. (2023). regl-scatterplot: A WebGL-Powered Scatter Plot Renderer. https://github.com/flekschas/regl-scatterplot
MIT. See LICENSE.