Unicode symbols as arrowheads in Makie

Is it possible to use other Symbols for the arrowheads in Makie? According to the docs, the arrowhead attribute is set by default to automatic, which is in 2D the symbol "▲". To use something like arrowhead="△" could be very useful but throws an error when trying to display the figure.

MWE

This works fine:

using CairoMakie
positions = Point2f.(rand(5), rand(5))
directions = Vec2f.(rand(5), rand(5))
arrows(positions, directions, arrowsize=15)

But this throws an error:

using CairoMakie
positions = Point2f.(rand(5), rand(5))
directions = Vec2f.(rand(5), rand(5))
arrows(positions, directions, arrowsize=15, arrowhead="△")
ERROR: MethodError: no method matching draw_marker(::Cairo.CairoContext, ::String, ::Vec{2, Float32}, ::Vec{2, Float32}, ::ColorTypes.RGBA{Float32}, ::Float32, ::Vec{2, Float32}, ::Quaternionf)
Closest candidates are:
draw_marker(::Any, ::Circle, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at ~/.julia/packages/CairoMakie/F9l4g/src/primitives.jl:278
draw_marker(::Any, ::GeometryBasics.HyperRectangle, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at ~/.julia/packages/CairoMakie/F9l4g/src/primitives.jl:292
draw_marker(::Any, ::Char, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at ~/.julia/packages/CairoMakie/F9l4g/src/primitives.jl:228

use a Char like '△' not "△"

1 Like

Thanks a lot!

using CairoMakie
positions = Point2f.(rand(5), rand(5))
directions = Vec2f.(rand(5), rand(5))
arrows(positions, directions, arrowsize=15, arrowhead='△')

Thanks, wile the solution was simple, and I understand the concept of Char*, would it be appropriate for that package (and most or all others), to also allow 1-letter strings? For the benefit of people coming from e.g. Python where there is no Char, and ‘△’ not “△” would mean the same, a string happens to be 1 Char long.

* Char may actually be a bad idea, in Swift since it’s based on grapeme-clusters, they’re “chars” are actually strings, often 1 Char as in Julia, but not always.