Skip to content

swarmchart

plot · scripts/plot/draw/swarmchart.m

: swarmchart (x, y)
: swarmchart (x, y, sz)
: swarmchart (x, y, sz, c)
: swarmchart (…, mkr)
: swarmchart (…, "filled")
: swarmchart (ax, …)
: swarmchart (…, Name, Value)
: s = swarmchart (…)

Swarm scatter chart: a scatter plot with points jittered in one dimension so overlapping markers are visible (MATLAB R2020b+ / R2026a compat).

By default points are offset in x using a density-weighted random jitter (kernel density of y within each unique x location). Pass "YJitter", "density" for a horizontal swarm.

x must be numeric or categorical (error id MATLAB:scatter:InvalidSwarmXData). The return value is a Scatter object (or array) when graphics are available.