# Makie scatter and errorbar combine in legend?

**URL:** <https://discourse.julialang.org/t/makie-scatter-and-errorbar-combine-in-legend/126424>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 28, 2025, 3:02pm UTC](https://discourse.julialang.org/t/makie-scatter-and-errorbar-combine-in-legend/126424 "2025-02-28T15:02:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [February 28, 2025, 3:02pm UTC](https://discourse.julialang.org/t/makie-scatter-and-errorbar-combine-in-legend/126424/1 "2025-02-28T15:02:20Z")

</div>

Since `errorbar` does not take `marker` option, in order to make a plot the [documentation](https://docs.makie.org/dev/reference/plots/errorbars) recommend something like:

```julia
errorbars!(xs, ys, higherrors, color = :red) # same low and high error

# plot position scatters so low and high errors can be discriminated
scatter!(xs, ys, markersize = 3, color = :black)

```

However, if you then try to have legend for this item, it looks like:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/9/998fe79afd1b33fe57285fcd845a98bee81fd107.png)

Is there a way to combine them in the legend without manually creating a `Legend()` item?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [February 28, 2025, 3:09pm UTC](https://discourse.julialang.org/t/makie-scatter-and-errorbar-combine-in-legend/126424/2 "2025-02-28T15:09:44Z")

</div>

thanks to @aplavin

```julia
axislegend(merge=true)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/6/363edbea2e960b7c168d4a75916d0044d57d9adc.png)

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [March 4, 2025, 4:58am UTC](https://discourse.julialang.org/t/makie-scatter-and-errorbar-combine-in-legend/126424/3 "2025-03-04T04:58:53Z")

</div>

I actually realized this is not what I wanted, because the error bar should be vertical.

For example, this looks wrong:

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

axislegend()
current_figure()

```

with `merge=true`  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/e/decbadb88e4523abb0409fa557d97504644e02ff.png)

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/0/701ffd845b79a264aefe4ce4fe3291b37af997be.png)

I suppose one can do this manually: [Makie errorbars in legend look awkward - #2 by jules](https://discourse.julialang.org/t/makie-errorbars-in-legend-look-awkward/104832/2)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [March 4, 2025, 5:59am UTC](https://discourse.julialang.org/t/makie-scatter-and-errorbar-combine-in-legend/126424/4 "2025-03-04T05:59:45Z")

</div>

You can now use legend overrides for this, although there’s still a bug with label merging in this case I think, where it doesn’t associate the same label with different overrides applied

---

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [March 4, 2025, 10:57am UTC](https://discourse.julialang.org/t/makie-scatter-and-errorbar-combine-in-legend/126424/5 "2025-03-04T10:57:50Z")

</div>

Yes `merge=true` just merges what it has, doesn’t change how entries look.  
I also use rangebars/errorbars quite often (not as often as @jling probably 🙂 ), at some point was looking into the code trying to find how to fix legend entries for them. But didn’t really manage to do that. Maybe @jling will have more luck?..
