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

Axis colors policy #156

Open
jariji opened this issue Mar 23, 2024 · 0 comments
Open

Axis colors policy #156

jariji opened this issue Mar 23, 2024 · 0 comments

Comments

@jariji
Copy link

jariji commented Mar 23, 2024

AxisKeys.jl/src/show.jl

Lines 45 to 57 in c16d0fc

end
function colour(A::AbstractArray, dims)
all(d -> keys_or_axes(A,d) === OneTo(1), dims) && return :light_black
colour(A, promote_type(map(d -> eltype(keys_or_axes(A,d)), dims)...))
end
function colour(A::AbstractArray, T::Type)
T <: AbstractFloat && return :cyan
T <: Number && return :blue
T <: AbstractString && return :yellow #:green
T <: AbstractChar && return :yellow
T <: Symbol && return :magenta
:red
end

I like to have all-different axis colors so I want to override the color rule, but that is piracy which I prefer to avoid. Is there a way to either provide all-different colors by default or somehow let me override the default behavior without piracy?

julia> AxisKeys.colour(::AbstractArray, i::Int) = let cs = [:cyan, :yellow, :magenta, :blue]
           cs[mod1(i,length(cs))] 
       end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant