First, I love Makie and am currently switching to it as my daily plotting library!
I often need arrow tips on the axis ends. Unfortunately, I could not find anything about it in the docs, so I used the following workaround:
function axisarrows!(ax::Axis=current_axis(); kwargs...)
points = [
directions = [Vec2f(1, 0), Vec2f(0, 1)]
arrows!(ax.parent.scene, points, directions; kwargs...)
f, ax, p = lines(1:10, rand(10))
hidespines!(ax, :t, :r)
One downside is that the axisarrows! function always needs to be run last because it plots arrows over the whole scene. Any modification to the ticks would lead to a wrong position of the axis arrows.
So Is there a better method or a way to modify my workaround to make it more robust and flexible? Maybe if I use Observables so that the axis arrow position gets updated automatically? I`ve seen similar things in this thread:
Is it possible that Makie will natively support axis arrows in the future?
Yes exactly, you need to use observables so the endpoints auto update whenever the axis shifts. endpoints is already an observable, just with two points. You extract the value out of it statically but need to do it such that you make a new observable with one point. The short syntax would be @lift($(ax.elements[:xaxis].attributes.endpoints)).