API Reference
SwarmMakie.JitterAlgorithm
SwarmMakie.NoBeeswarm
SwarmMakie.PseudorandomJitter
SwarmMakie.QuasirandomJitter
SwarmMakie.SeabornBeeswarm
SwarmMakie.SimpleBeeswarm
SwarmMakie.SimpleBeeswarm2
SwarmMakie.UniformJitter
SwarmMakie.WilkinsonBeeswarm
SwarmMakie.beeswarm
SwarmMakie.could_overlap
SwarmMakie.first_non_overlapping_candidate
SwarmMakie.position_candidates
SwarmMakie.JitterAlgorithm Type
The abstract type for jitter algorithms, which are markersize-agnostic.
sourceSwarmMakie.NoBeeswarm Type
A simple no-op algorithm, which causes the scatter plot to be drawn as if you called scatter
and not beeswarm
.
SwarmMakie.PseudorandomJitter Type
PseudorandomJitter(; jitter_width = 1.0)
A jitter algorithm that uses a pseudorandom distribution to create the jitter. A pseudorandom distribution is a uniform distribution weighted by the PDF of the data.
sourceSwarmMakie.QuasirandomJitter Type
QuasirandomJitter(; jitter_width = 1.0)
A jitter algorithm that uses a quasirandom (van der Corput) distribution weighted by the data's pdf to jitter the data points.
sourceSwarmMakie.SeabornBeeswarm Type
SeabornBeeswarm()
A beeswarm algorithm based on the seaborn
Python package.
More adaptive to marker size than SimpleBeeswarm
, but takes longer to compute.
SwarmMakie.SimpleBeeswarm Type
SimpleBeeswarm()
A simple implementation like Matplotlib's algorithm.
This algorithm dodges in x
but preserves the exact y
coordinate of each point. If you don't want to preserve the y coordinate, check out WilkinsonBeeswarm
.
SwarmMakie.SimpleBeeswarm2 Type
SimpleBeeswarm2()
A simple beeswarm implementation, that minimizes overlaps. This is the default algorithm used in beeswarm
.
This algorithm dodges in x
but preserves the exact y
coordinate of each point. If you don't want to preserve the y coordinate, check out WilkinsonBeeswarm
.
SwarmMakie.UniformJitter Type
UniformJitter(; jitter_width = 1.0)
A jitter algorithm that uses a uniform distribution to create the jitter.
sourceSwarmMakie.WilkinsonBeeswarm Type
WilkinsonBeeswarm()
A beeswarm algorithm that implements Leland Wilkinson's original dot-hist algorithm.
This is essentially a histogram with dots, where all dots are binned in the y
(non-categorical) direction, and then dodged in the x
(categorical) direction.
Original y-coordinates are not preserved, and if you want that try SimpleBeeswarm
instead.
SwarmMakie.beeswarm Method
beeswarm(x, y)
beeswarm(positions)
beeswarm
is a PointBased
recipe like scatter
, accepting all of scatter
's input.
It displaces points which would otherwise overlap in the x-direction by binning in the y direction.
Specific attributes to beeswarm
are:
algorithm = SimpleBeeswarm2()
: The algorithm used to lay out the beeswarm markers.side = :both
: The side towards which markers should extend. Can be:left
,:right
, or both.direction = :y
: Controls the direction of the beeswarm. Can be:y
(vertical) or:x
(horizontal).gutter = nothing
: Creates a gutter of a desired size around each category. Gutter size is always in data space.gutter_threshold = .5
: Emit a warning of the number of points added to a gutter per category exceeds the threshold.
Arguments
Available attributes and their defaults for Plot{SwarmMakie.beeswarm}
are:
algorithm SimpleBeeswarm2()
alpha 1.0
clip_planes MakieCore.Automatic()
color :black
colormap :viridis
colorrange MakieCore.Automatic()
colorscale identity
cycle [:color]
depth_shift 0.0f0
depthsorting false
direction :y
distancefield "nothing"
glowcolor (:black, 0.0)
glowwidth 0.0
gutter "nothing"
gutter_threshold 0.5
highclip MakieCore.Automatic()
inspectable true
inspector_clear MakieCore.Automatic()
inspector_hover MakieCore.Automatic()
inspector_label MakieCore.Automatic()
lowclip MakieCore.Automatic()
marker :circle
marker_offset Float32[0.0, 0.0, 0.0]
markersize 9
markerspace :pixel
nan_color :transparent
overdraw false
rotation Billboard{Float32}(0.0f0)
side :both
space :data
ssao false
strokecolor :black
strokewidth 0
transform_marker false
transparency false
uv_offset_width (0.0, 0.0, 0.0, 0.0)
visible true
Example
using Makie, SwarmMakie
beeswarm(ones(100), randn(100); color = rand(RGBf, 100))
SwarmMakie.could_overlap Method
could_overlap(position, markersize, positions, markersizes)
Check if a point given by position
with markersize markersize
could overlap with any other point in the swarm. Returns a vector of integer indices.