Skip to content

Axis colors policy #156

Description

@jariji

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions