Skip to content

Commit

Permalink
Merge branch 'main' into support_vec_markersize
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 authored Jan 27, 2025
2 parents 2c8dd6e + 799bbc2 commit 0e8cbd7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions src/algorithms/simple2.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# # Simple beeswarm 2 (default)
# This algorithm was contributed by Julius Krumbiegel (@jkrumbiegel) in PR #29.

"""
SimpleBeeswarm2()
A simple beeswarm implementation, that minimizes overlaps.
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`](@ref).
"""
struct SimpleBeeswarm2 <: BeeswarmAlgorithm
end

export SimpleBeeswarm2

function calculate!(buffer::AbstractVector{<: Point2}, alg::SimpleBeeswarm2, positions::AbstractVector{<: Point2}, markersize, side::Symbol)
ys = last.(positions)
Expand Down
4 changes: 2 additions & 2 deletions src/recipe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export NoBeeswarm
It displaces points which would otherwise overlap in the x-direction by binning in the y direction.
Specific attributes to `beeswarm` are:
- `algorithm = SimpleBeeswarm()`: The algorithm used to lay out the beeswarm markers.
- `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.
Expand All @@ -34,7 +34,7 @@ beeswarm(ones(100), randn(100); color = rand(RGBf, 100))
@recipe(Beeswarm, positions) do scene
return merge(
Attributes(
algorithm = SimpleBeeswarm(),
algorithm = SimpleBeeswarm2(),
side = :both,
direction = :y,
gutter = nothing,
Expand Down

0 comments on commit 0e8cbd7

Please sign in to comment.