# Makie 3D "flatten" scatter points in x-y axis

**URL:** <https://discourse.julialang.org/t/makie-3d-flatten-scatter-points-in-x-y-axis/126589>\
**Category:** Visualization\
**Tags:** plotting, makie, 3d\
**Created:** [March 5, 2025, 5:29pm UTC](https://discourse.julialang.org/t/makie-3d-flatten-scatter-points-in-x-y-axis/126589 "2025-03-05T17:29:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmdenis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmdenis/32/211517_2.png) [@cmdenis](https://discourse.julialang.org/u/cmdenis)\
**Post date:** [March 5, 2025, 5:29pm UTC](https://discourse.julialang.org/t/makie-3d-flatten-scatter-points-in-x-y-axis/126589/1 "2025-03-05T17:29:56Z")

</div>

Hi there,

I’m trying to make a 3D plot with Makie, and I’d like to plot some scatter points “flat” on the x-y plane of the plot.

Here is the M(not)WE I have so far:

```julia
using CairoMakie

# Initialize figure
fig = Figure(size = (800, 400))

# Initialize Axis
ax = Axis3(fig[1, 1])

# Make scatter plot points (on the "floor")
scatter!(ax, [0, 0.5], [0, -0.5], [-0.5, -0.5], markersize = 0.2, markerspace = :data, marker = Circle, strokewidth = 2)

# Make Contour plots
contour3d!(ax, 
	-1:0.1:1, 
	-1:0.1:1, 
	(x, y) -> -x^4+x^2 + y^2,
	levels = 10,
	linewidth = 4,
	transparency = true
)

fig

```

Which gives me this:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/2/621d4db7d60240d0210d869ffb2faa5f1a4597a6.jpeg)

I would like to see the two blue scatter points as if they were plotted on the 2D XY plane. Is there a way to do this?  
I read the documentation and tried finding something similar online, but couldn’t. Maybe I’m not familiar with the terminology to ask a proper question 😅.

If that makes sense, I’d like them to turn into tilted ellipses to give them proper perspective in the plot (as if they were 2D images drawn on the floor of the 3D box).

Thanks in advance!

---

<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:** [March 5, 2025, 7:19pm UTC](https://discourse.julialang.org/t/makie-3d-flatten-scatter-points-in-x-y-axis/126589/2 "2025-03-05T19:19:01Z")

</div>

scatter is not really made for these kinds of marker transformations I think, at least I tried `markerspace = :data` and that didn’t look correct in 3d (maybe that’s just an implementation omission in CairoMakie though).

You could use `poly!` and that will transform the coordinates accordingly:

```julia
f = Figure()
ax = Axis3(f[1, 1])

contour3d!(ax, 
	-1:0.1:1, 
	-1:0.1:1, 
	(x, y) -> -x^4+x^2 + y^2,
	levels = 10,
	linewidth = 4,
	transparency = true
)

poly!(ax, Circle(Point2f(-0.5, -0.5), 0.2))
f

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/3/83c503682a018cf034d714ec8ed2ab4cf4842bea.png)

---

<div class="post-metadata">

**Author:** ![cmdenis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cmdenis/32/211517_2.png) [@cmdenis](https://discourse.julialang.org/u/cmdenis)\
**Post date:** [March 5, 2025, 9:21pm UTC](https://discourse.julialang.org/t/makie-3d-flatten-scatter-points-in-x-y-axis/126589/3 "2025-03-05T21:21:30Z")

</div>

> [@jules](#):
>
> `poly!(ax, Circle(Point2f(-0.5, -0.5), 0.2))`

That’s perfect! Thanks!

---

<div class="post-metadata">

**Author:** ![ffreyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffreyer/32/21569_2.png) [@ffreyer](https://discourse.julialang.org/u/ffreyer)\
**Post date:** [March 6, 2025, 2:19pm UTC](https://discourse.julialang.org/t/makie-3d-flatten-scatter-points-in-x-y-axis/126589/4 "2025-03-06T14:19:02Z")

</div>

> scatter is not really made for these kinds of marker transformations I think, at least I tried `markerspace = :data` and that didn’t look correct in 3d (maybe that’s just an implementation omission in CairoMakie though).

Billboarding (that markers face the camera) isn’t controlled by markerspace. You need to set `rotation` for that. Here you can use `Vec3f(0,0,1)` to turn billboarding off and have marker facing upwards. This should work in all backends nowadays. (CairoMakie doesn’t apply perspective projection to markers but iirc Axis3 has very little of that by default)

Edit: Turning off billboarding requires both `markerspace = :data` and `rotation`
