# Scatter and line segments in Makie

**URL:** <https://discourse.julialang.org/t/scatter-and-line-segments-in-makie/137032>\
**Category:** New to Julia\
**Tags:** makie\
**Created:** [May 8, 2026, 6:42am UTC](https://discourse.julialang.org/t/scatter-and-line-segments-in-makie/137032 "2026-05-08T06:42:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahmah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mahmah/32/214326_2.png) [@mahmah](https://discourse.julialang.org/u/mahmah)\
**Post date:** [May 8, 2026, 6:42am UTC](https://discourse.julialang.org/t/scatter-and-line-segments-in-makie/137032/1 "2026-05-08T06:42:35Z")

</div>

I’m connecting markers with lines like this:

```julia-auto
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?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [May 8, 2026, 9:57am UTC](https://discourse.julialang.org/t/scatter-and-line-segments-in-makie/137032/2 "2026-05-08T09:57:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)\
**Post date:** [May 8, 2026, 11:01am UTC](https://discourse.julialang.org/t/scatter-and-line-segments-in-makie/137032/3 "2026-05-08T11:01:07Z")

</div>

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.
