# 3d plots with a matrix

**URL:** https://discourse.julialang.org/t/3d-plots-with-a-matrix/87006
**Category:** New to Julia
**Created:** [September 9, 2022, 5:51pm UTC](https://discourse.julialang.org/t/3d-plots-with-a-matrix/87006 "2022-09-09T17:51:08Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)
#### Post date: [September 9, 2022, 8:36pm UTC](https://discourse.julialang.org/t/3d-plots-with-a-matrix/87006/2 "2022-09-09T20:36:42Z")

</div>

- If you want a scatter plot, you can get the x and y coordinates as

```julia
X = [xj for _ in y, xj in x]
Y = [yi for yi in y, _ in x]

scatter( X[:], Y[:], Z[:] )

```

(See for example [Meshgrid function in Julia - #26 by henry2004y](https://discourse.julialang.org/t/meshgrid-function-in-julia/48679/26))

- Maybe you are also interested in a surface plot, see [surface](https://makie.juliaplots.org/dev/examples/plotting_functions/surface/). Here you can directly use your data `x, y, z`.

* * *

More a side note, if you don’t want to create the vectors `X` and `Y` you could use [GitHub - JuliaArrays/LazyGrids.jl: A Julia package for representing multi-dimensional grids](https://github.com/JuliaArrays/LazyGrids.jl)

---

_[View the full topic](https://discourse.julialang.org/t/3d-plots-with-a-matrix/87006)._
