3D Scatter with 2D Projections

Saw an interesting post on twitter https://twitter.com/BrainInTheMind/status/1517543839833243649 that got me wondering if there was a supported way to project 3D data onto the axes using Plots or Makie. I came up with my own solution:

let
	plot()
	scatter!(0 .* x, y, z, marker=:x, alpha=.6)
	scatter!(x, (0 .* y) .+ maximum(y), z, marker=:x, alpha=.6)
	scatter!(x, y, 0 .* z, marker=:x, alpha=.6)
	
	scatter!(x,y,z, legend=false)
end

Which feels super hacky but produces the correct results:

I was wondering if something like scatter(x, y, z, project=true) was supported to get the same result, or if it was possible to put other plots on the different planes such as a heatmap.

If you’re fine with using custom PlotlyJS features, you could use something like

General examples here: 3d · PlotlyJS
but no examples for your specific case (yet).

1 Like