Makie.jl
Makie.jl copied to clipboard
`merge` and `unique` kwargs with Legend on user specified plots + legends
The merge and unique kwargs don't work for the Legend method where the user specifies an array of plots and labels (instead of collecting the plots and labels from an Axis). I realize that a user could do the merging and uniqueness for themselves at this point, but it would be great to still support these kwargs (or error appropriately) for the Legend method that delegates down to layoutable(::Type{Legend}, ::Any, ::AbstractArray, ::AbstractArray{<:AbstractString}, ::Union{Nothing, AbstractString}; kwargs...).
Do you mean you would want to pass an array where there are multiple labels that are the same, but you don't want to do the grouping yourself? In what situation did this arise for you, just so I understand the use case better?
I just ran into this as well. My use-case is I was happy with axislegend until my labels got too long and intruded on the plot content. So I wanted to move the legend outside the plot area so the plot isn't obstructed. But then it seems I have to move off of axislegend and go to Legend. In this case, however, if I do Legend(fig[1,2], ax), I have duplicate labels, which previously merge/unique were handling for me.
Oh wait, it does work now! https://github.com/JuliaPlots/Makie.jl/blob/1fe9910ada898cbe4fa4f6f272c00fdfdb911119/src/makielayout/blocks/legend.jl#L521
It works with the Axis argument, it doesn't work with the list of plots that the issue is about. That's because I assumed if you control the list of plots, you wouldn't need merge.