# Makie errorbars in legend look awkward

**URL:** <https://discourse.julialang.org/t/makie-errorbars-in-legend-look-awkward/104832>\
**Category:** Visualization\
**Tags:** cairomakie\
**Created:** [October 11, 2023, 7:32am UTC](https://discourse.julialang.org/t/makie-errorbars-in-legend-look-awkward/104832 "2023-10-11T07:32:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Salmon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/salmon/32/22968_2.png) [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Post date:** [October 11, 2023, 7:32am UTC](https://discourse.julialang.org/t/makie-errorbars-in-legend-look-awkward/104832/1 "2023-10-11T07:32:01Z")

</div>

Hi,  
somehow I cannot find the solution to this problem online.  
I want a simple plot with errorbars which are shown in the legend:

```julia
fig = Figure()
ax = Axis(fig[1,1])

errorbars!(ax,1:10,rand(10),0.05*ones(10),color = :black,whiskerwidth = 12,label = "errors")
axislegend(ax)
fig

```

produces this plot:

 ![grafik](https://global.discourse-cdn.com/julialang/original/3X/3/1/3167f2ec67356c01a65642de2b601b36d24597c5.png)

The legend looks quite off, one cannot see that these symbols are actually errorbars, it looks more like a line.  
Does anyone know how to do this properly?

---

<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:** [October 11, 2023, 11:17am UTC](https://discourse.julialang.org/t/makie-errorbars-in-legend-look-awkward/104832/2 "2023-10-11T11:17:06Z")

</div>

> it looks more like a line

It is a line 🙂

`errorbars` has no specific legend overload so it just shows the one for the underlying `lines`. One could build a better one in principle, for example:

```julia
f = Figure()
Legend(f[1, 1], [[
    LineElement(linepoints = [Point2f(0.5, 0), Point2f(0.5, 1)]),
    MarkerElement(points = [Point2f(0.5, 0), Point2f(0.5, 1)], marker = :hline, markersize = 10),
]], ["errorbar"])
f

```

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

---

<div class="post-metadata">

**Author:** ![Salmon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/salmon/32/22968_2.png) [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Post date:** [October 11, 2023, 11:21am UTC](https://discourse.julialang.org/t/makie-errorbars-in-legend-look-awkward/104832/3 "2023-10-11T11:21:27Z")

</div>

Ah thank you, I see.  
Is there a specific reason for why there is no such overload or can one attempt a PR to change this?

---

<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:** [October 11, 2023, 2:10pm UTC](https://discourse.julialang.org/t/makie-errorbars-in-legend-look-awkward/104832/4 "2023-10-11T14:10:50Z")

</div>

No specific reason. I guess I didn’t want to deal with the caps and updating it correctly depending on errorbar direction.
