Makie: Płot a number line

LineAxis is the object that Axis uses. It is missing some defaultattributes without which it will complain, so I’ve set them here. It only works if endpoints are on a horizontal or vertical line:

f = Figure()
MakieLayout.LineAxis(f.scene,
    endpoints = Point2f0[(100, 300), (700, 300)],
    spinecolor = :black,
    labelfont = "Dejavu",
    ticklabelfont = "Dejavu",
    spinevisible = true,
    ticks = Makie.automatic,
    minorticks = IntervalsBetween(5),
    limits = (-1.4, 1.4),
    tickalign = 0.5,
    minortickalign = 0.5,
    ticksize = 15,
    minorticksize = 7.5
)
s = scatter!(f.scene, Point(710, 300, 50), marker = '▴', rotation = -pi/2, markersize = 20)
f

2 Likes