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

errorbar legend overload #4841

Open
Moelf opened this issue Mar 4, 2025 · 1 comment
Open

errorbar legend overload #4841

Moelf opened this issue Mar 4, 2025 · 1 comment
Labels
enhancement Feature requests and enhancements

Comments

@Moelf
Copy link
Contributor

Moelf commented Mar 4, 2025

https://discourse.julialang.org/t/makie-errorbars-in-legend-look-awkward/104832/2?u=jling

It would be nice to have a vertical line for errorbar legend, right now it doesn't combine usefully with lines:

stairs([1,3,2,1]; label="x")
errorbars!((2:4) .- 0.5, [3,2,1], [2,3,4]; label="x")

axislegend(; merge=true)
current_figure()

Image

@Moelf Moelf added the enhancement Feature requests and enhancements label Mar 4, 2025
@asinghvi17
Copy link
Member

asinghvi17 commented Mar 4, 2025

You can define Makie.legendelements(plot::Errorbars, legend) in order to do this.

See e.g.

function legendelements(plot::Union{Violin, BoxPlot, CrossBar}, legend)
color = extract_color(plot, legend[:polycolor])
LegendElement[PolyElement(
color = color,
strokecolor = choose_scalar(plot.strokecolor, legend[:polystrokecolor]),
strokewidth = choose_scalar(plot.strokewidth, legend[:polystrokewidth]),
colormap = get(plot, :colormap, :viridis),
colorrange = get(plot, :colorrange, automatic),
alpha = get(plot, :alpha, 1f0),
)]
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and enhancements
Projects
None yet
Development

No branches or pull requests

2 participants