Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define AoG.mergeable for beeswarm #31

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ext/AlgebraOfGraphicsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module AlgebraOfGraphicsExt
using SwarmMakie, AlgebraOfGraphics, Makie
import AlgebraOfGraphics as AOG

# Define the "aesthetic mapping" - which kwargs go where
function AlgebraOfGraphics.aesthetic_mapping(::Type{Beeswarm}, ::AOG.Normal, ::AOG.Normal)
AOG.dictionary([
1 => AOG.AesX,
Expand All @@ -13,9 +14,14 @@ function AlgebraOfGraphics.aesthetic_mapping(::Type{Beeswarm}, ::AOG.Normal, ::A
])
end


# Define the legend elements (scatter, in this case)
function AOG.legend_elements(T::Type{Beeswarm}, attributes, scale_args::AOG.MixedArguments)
return AOG.legend_elements(Makie.Scatter, attributes, scale_args) # same legend as Scatter
end

# Instruct AoG to always merge all beeswarm plots in the same layer
# This means that if a `color` with 2 unique values is given,
# then only one beeswarm plot object is created (not two).
AOG.mergeable(::Type{<: Beeswarm}, primary) = true

end
Loading