Help with a new routine to add labels to the tail of each plot

If you want to do this really well, I’d probably make a new Block type like TailLegend or so. This one would consist of a campixel! scene to plot the labels into. The scene’s width can be auto-determined given the size of the text plots inside, and then the whole block can adopt that width. You can check the code for Label to compare how that can be done, for example. Such a Block could then be placed at f[x, y, Right()] such that it will increase the protrusion space of the axis layout cell on that side.

f = Figure()
ax = Axis(f[1, 1])
Axis(f[2, 1])
Axis(f[2, 2])
Axis(f[1, 2])
leg = LScene(f[1, 1, Right()], scenekw = (; camera = campixel!), show_axis = false)
padding = 5
for i in 1:5
    l = lines!(ax, (1:10) .* i)
    y = i * 30 # this should automatically change given the projected ends of the lines
    text!(leg, padding, y, text = "Label $i", color = l.color)
end
textbb = mapreduce(x -> Makie.boundingbox(x, :pixel), union, leg.scene.plots)
leg.width = textbb.widths[1] + 2 * padding
f

You could also use a single text plot with an array to make it more efficient, this is just a rough sketch.