Salmon
October 11, 2023, 7:32am
1
Hi,
somehow I cannot find the solution to this problem online.
I want a simple plot with errorbars which are shown in the legend:
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:
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?
jules
October 11, 2023, 11:17am
2
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:
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
1 Like
Salmon
October 11, 2023, 11:21am
3
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?
jules
October 11, 2023, 2:10pm
4
No specific reason. I guess I didn’t want to deal with the caps and updating it correctly depending on errorbar direction.
1 Like