Scatter and line segments in Makie

I’m connecting markers with lines like this:

p = meshscatter!(ax,X[framenum,:],Y[framenum,:],Z[framenum,:],markersize=msize,color=mcolor,colormap=mcolormap,clip_planes=Plane3f[])
conn = [(p[1][][m.conn[i,1]],p[1][][m.conn[i,2]]) for i in 1:size(m.conn,1)]
pl = linesegments!(ax, conn,color=conncolor,linewidth=connwidth)

But this way the lines get drawn on top of the markers. Is there any easy way to have it the other way around?

You could try reversing plot order in ax.scene.plots after insertion, it’s just a vector

Could you provide a MWE? I’m struggling to mentally picture the order issue (in 3D), nor can I reproduce it in code.


Apart from reversing ax.scene.plots afterwards, you can presumably also just switch the order of meshcatter! and linesegments! in the first place. Your p[1][] (presumably) consists of the input points, so you don’t need to first run meshscatter to get this.