finds.dev

LKremer/ggpointdensity

Introduces geom_pointdensity(): A Cross Between a Scatter Plot and a 2D Density Plot.

View on GitHub

★ 455RGPL-3.0updated Dec 2025

// the take

ggpointdensity is a small ggplot2 extension that adds geom_pointdensity(), a geom that colors individual scatter points by the density of their neighbors instead of collapsing them into bins or contours. It's for R users doing exploratory data analysis on datasets with heavy point overlap who still want to spot individual outliers.

It solves a genuinely specific problem: geom_point() oversaturates with overlapping points, while geom_density2d()/geom_bin2d() hide individual points entirely — this keeps both. It plugs into ggplot2's stat system properly, exposing after_stat(density) and after_stat(ndensity) so you can reuse the computed density for color, size, or per-facet relative scaling rather than being stuck with a fixed output. It's on CRAN with R-CMD-check CI, which for an R package actually means something — it installs cleanly and passes checks, not just a GitHub curiosity. The neighbor-counting core is written in C (src/count_neighbors.c), so it's not a naive R double-loop that falls over past a few thousand points.

Development has effectively stopped — this is a finished, single-purpose geom with no roadmap, so don't expect new kernels, alternative density metrics, or support for huge datasets. Bandwidth selection (the adjust parameter) is manual trial-and-error; there's no data-driven default or guidance for picking it on unfamiliar data. Because it computes a true per-point neighbor density rather than binning first, performance will degrade on large point clouds (hundreds of thousands+) in a way geom_bin2d() wouldn't. It's maintained by two people on a narrow feature set, so if ggplot2's internals shift significantly down the line, there's no guarantee of a quick compatibility fix.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
455
Forks
26
Language
R
License
GPL-3.0
Last commit
28 Dec 2025

// nearby

If ggpointdensity isn't quite it.

All repos →