API Reference
SwarmMakie.BeeswarmSwarmMakie.JitterAlgorithmSwarmMakie.NoBeeswarmSwarmMakie.PseudorandomJitterSwarmMakie.QuasirandomJitterSwarmMakie.SimpleBeeswarmSwarmMakie.UniformJitterSwarmMakie.WilkinsonBeeswarmSwarmMakie.beeswarmSwarmMakie.beeswarm!
SwarmMakie.Beeswarm Type
Beeswarm is the plot type associated with plotting function beeswarm. Check the docstring for beeswarm for further information.
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()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()A jitter algorithm that uses a quasirandom (van der Corput) distribution weighted by the data's pdf to jitter the data points.
sourceSwarmMakie.SimpleBeeswarm Type
SimpleBeeswarm()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 want a more organized appearance and don't need to preserve the exact y coordinates, you can try WilkinsonBeeswarm.
SwarmMakie.UniformJitter Type
UniformJitter()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 Function
beeswarm(groups, values)beeswarm is a variant of scatter where values are plotted in several groups. In a normal scatter plot, each group would form a line of possibly overlapping points, where especially for larger numbers of points it becomes hard to tell how many points there are in each group. The beeswarm recipe moves the points off the group line such that they overlap less or not at all. There are different offset algorithms to choose from, each with individual visual characteristics.
Example
using Makie, SwarmMakie
categories = repeat(1:3, inner = 50)
values = [randn(50); randn(50) .- 2; randn(50) .* 2 .+ 2]
beeswarm(categories, values)Plot type
The plot type alias for the beeswarm function is Beeswarm.
Attributes
algorithm = :default — The algorithm used to lay out the beeswarm markers. The built-in algorithms can be accessed with Symbol shorthands.
:default- Beeswarm with preserved y coordinates and overlap avoidance (SimpleBeeswarm()):wilkinson- Wilkinson's dot-stacking algorithm which does not preserve y (WilkinsonBeeswarm()):uniform- Uniform random jitter (UniformJitter()):pseudorandom- Random jitter scaled by density (PseudorandomJitter()):quasirandom- Quasirandom (low-discrepancy) jitter:none- No displacement
alpha = 1.0 — The alpha value of the colormap or color attribute. Multiple alphas like in plot(alpha=0.2, color=(:red, 0.5), will get multiplied.
clip_planes = @inherit clip_planes automatic — Clip planes offer a way to do clipping in 3D space. You can set a Vector of up to 8 Plane3f planes here, behind which plots will be clipped (i.e. become invisible). By default clip planes are inherited from the parent plot or scene. You can remove parent clip_planes by passing Plane3f[].
color = @inherit markercolor — Sets the color of the marker. If no color is set, multiple calls to scatter! will cycle through the axis color palette.
colormap = @inherit colormap :viridis — Sets the colormap that is sampled for numeric colors. PlotUtils.cgrad(...), Makie.Reverse(any_colormap) can be used as well, or any symbol from ColorBrewer or PlotUtils. To see all available color gradients, you can call Makie.available_gradients().
colorrange = automatic — The values representing the start and end points of colormap.
colorscale = identity — The color transform function. Can be any function, but only works well together with Colorbar for identity, log, log2, log10, sqrt, logit, Makie.pseudolog10, Makie.Symlog10, Makie.AsinhScale, Makie.SinhScale, Makie.LogScale, Makie.LuptonAsinhScale, and Makie.PowerScale.
cycle = [:color] — Sets which attributes to cycle when creating multiple plots. The values to cycle through are defined by the parent Theme. Multiple cycled attributes can be set by passing a vector. Elements can
directly refer to a cycled attribute, e.g.
:colormap a cycled attribute to a palette attribute, e.g.
:linecolor => :colormap multiple cycled attributes to a palette attribute, e.g.
[:linecolor, :markercolor] => :color
depth_shift = 0.0 — Adjusts the depth value of a plot after all other transformations, i.e. in clip space, where -1 <= depth <= 1. This only applies to GLMakie and WGLMakie and can be used to adjust render order (like a tunable overdraw).
depthsorting = false — Enables depth-sorting of markers which can improve border artifacts. Currently supported in GLMakie only.
direction = :y — Controls the direction of the beeswarm. Can be :y (vertical) or :x (horizontal).
distancefield = nothing — Optional distancefield used for e.g. font and bezier path rendering. Will get set automatically.
dodge = Makie.automatic — Dodge can be used to separate beeswarms drawn at the same position. For this each beeswarm is given an integer value corresponding to its position relative to the given positions. E.g. with positions = [1, 1, 1, 2, 2, 2] we have 3 beeswarms at each position which can be separated by dodge = [1, 2, 3, 1, 2, 3].
dodge_gap = 0.03 — Sets the gap between dodged beeswarms relative to the size of the dodged beeswarms.
font = "default" — Sets the font to be used for character markers
fxaa = false — Adjusts whether the plot is rendered with fxaa (fast approximate anti-aliasing, GLMakie only). Note that some plots implement a better native anti-aliasing solution (scatter, text, lines). For them fxaa = true generally lowers quality. Plots that show smoothly interpolated data (e.g. image, surface) may also degrade in quality as fxaa = true can cause blurring.
gap = 0.2 — Gap space reserved from jitter columns as a fraction of width.
glowcolor = (:black, 0.0) — Sets the color of the glow effect around the marker.
glowwidth = 0.0 — Sets the size of a glow effect around the marker.
highclip = automatic — The color for any value above the colorrange.
inspectable = @inherit inspectable — Sets whether this plot should be seen by DataInspector. The default depends on the theme of the parent scene.
inspector_clear = automatic — Sets a callback function (inspector, plot) -> ... for cleaning up custom indicators in DataInspector.
inspector_hover = automatic — Sets a callback function (inspector, plot, index) -> ... which replaces the default show_data methods.
inspector_label = automatic — Sets a callback function (plot, index, position) -> string which replaces the default label generated by DataInspector.
lowclip = automatic — The color for any value below the colorrange.
marker = @inherit marker — Sets the scatter marker.
marker_offset = Vec3f(0) — The offset of the marker from the given position in markerspace units. An offset of 0 corresponds to a centered marker.
markersize = @inherit markersize — Sets the size of the marker by scaling it relative to its base size which can differ for each marker. A Real scales x and y dimensions by the same amount. A Vec or Tuple with two elements scales x and y separately. An array of either scales each marker separately. Humans perceive the area of a marker as its size which grows quadratically with markersize, so multiplying markersize by 2 results in a marker that is 4 times as large, visually.
markerspace = :pixel — Sets the space in which markersize is given. See Makie.spaces() for possible inputs
model = automatic — Sets a model matrix for the plot. This overrides adjustments made with translate!, rotate! and scale!.
n_dodge = Makie.automatic — Sets the number of groups participating in the dodge. Can be increased if not all groups are present in the dodge vector.
nan_color = :transparent — The color for NaN values.
overdraw = false — Controls if the plot will draw over other plots. This specifically means ignoring depth checks in GL backends
rotation = Billboard() — Sets the rotation of the marker. A Billboard rotation is always around the depth axis.
seed = nothing — Random seed for jitter algorithms. Internally, StableRNGs is used for random number generation so that results for a given seed are reproducible.
side = :both — The side towards which markers should extend. Can be :left, :right, or both.
space = :data — Sets the transformation space for box encompassing the plot. See Makie.spaces() for possible inputs.
ssao = false — Adjusts whether the plot is rendered with ssao (screen space ambient occlusion). Note that this only makes sense in 3D plots and is only applicable with fxaa = true.
strokecolor = @inherit markerstrokecolor — Sets the color of the outline around a marker.
strokewidth = @inherit markerstrokewidth — Sets the width of the outline around a marker.
transform_marker = false — Controls whether the model matrix (without translation) applies to the marker itself, rather than just the positions. (If this is true, scale! and rotate! will affect the marker.
transformation = :automatic — Controls the inheritance or directly sets the transformations of a plot. Transformations include the transform function and model matrix as generated by translate!(...), scale!(...) and rotate!(...). They can be set directly by passing a Transformation() object or inherited from the parent plot or scene. Inheritance options include:
:automatic: Inherit transformations if the parent and childspaceis compatible:inherit: Inherit transformations:inherit_model: Inherit only model transformations:inherit_transform_func: Inherit only the transform function:nothing: Inherit neither, fully disconnecting the child's transformations from the parent
Another option is to pass arguments to the transform!() function which then get applied to the plot. For example transformation = (:xz, 1.0) which rotates the xy plane to the xz plane and translates by 1.0. For this inheritance defaults to :automatic but can also be set through e.g. (:nothing, (:xz, 1.0)).
transparency = false — Adjusts how the plot deals with transparency. In GLMakie transparency = true results in using Order Independent Transparency.
visible = true — Controls whether the plot gets rendered or not.
width = Makie.automatic — Width of the jitter columns in data space. By default the smallest difference between categories.
SwarmMakie.beeswarm! Function
beeswarm! is the mutating variant of plotting function beeswarm. Check the docstring for beeswarm for further information.