Skip to content

API Reference

SwarmMakie.JitterAlgorithm Type

The abstract type for jitter algorithms, which are markersize-agnostic.

source
SwarmMakie.NoBeeswarm Type

A simple no-op algorithm, which causes the scatter plot to be drawn as if you called scatter and not beeswarm.

source
SwarmMakie.PseudorandomJitter Type
julia
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.

source
SwarmMakie.QuasirandomJitter Type
julia
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.

source
SwarmMakie.SeabornBeeswarm Type
julia
SeabornBeeswarm()

A beeswarm algorithm based on the seaborn Python package.

More adaptive to marker size than SimpleBeeswarm, but takes longer to compute.

source
SwarmMakie.SimpleBeeswarm Type
julia
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.

source
SwarmMakie.SimpleBeeswarm2 Type
julia
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.

source
SwarmMakie.UniformJitter Type
julia
UniformJitter(; jitter_width = 1.0)

A jitter algorithm that uses a uniform distribution to create the jitter.

source
SwarmMakie.WilkinsonBeeswarm Type
julia
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.

source
SwarmMakie.beeswarm Method
julia
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

julia
using Makie, SwarmMakie
beeswarm(ones(100), randn(100); color = rand(RGBf, 100))
source
SwarmMakie.could_overlap Method
julia
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.

source
SwarmMakie.first_non_overlapping_candidate Method
julia
Returns `(position::Point2f, idx::Int)`
source
SwarmMakie.position_candidates Method

Returns (positions::Vector{Point2f}, idxs::Vector{Int}).

source