Skip to content

density with gradient color cannot be added to Legend #2289

@fatteneder

Description

@fatteneder

MWE

using GLMakie
GLMakie.activate!()

f = Figure()
ax = Axis(f[1,1])

density!(ax, randn(200) .- 2sin(2/3*pi),
         color = :x, colormap = :thermal, colorrange = (-5, 5),
         strokewidth = 1, strokecolor = :black, label="density")

Legend(f[1,2], ax)

f

throws

julia> include("new_mwe.jl")
ERROR: LoadError: Unknown color: x

The above works if any other <:Colorant is given and it then plots a little square with that color as the marker in the Legend.

Should we plot a squeezed colorbar as the legend marker in this case?

Btw: I think the same question also applies to a heatmap. However, there isn't an overload for of legendelements for it yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Legend & ColorbarenhancementFeature requests and enhancementsplanningFor discussion and planning development

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions