# How to plot a cube in 3D in Plots.jl

**URL:** https://discourse.julialang.org/t/how-to-plot-a-cube-in-3d-in-plots-jl/86919
**Category:** Visualization
**Tags:** plots, 3d
**Created:** [September 8, 2022, 12:46am UTC](https://discourse.julialang.org/t/how-to-plot-a-cube-in-3d-in-plots-jl/86919 "2022-09-08T00:46:15Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)
#### Post date: [September 8, 2022, 6:55am UTC](https://discourse.julialang.org/t/how-to-plot-a-cube-in-3d-in-plots-jl/86919/2 "2022-09-08T06:55:05Z")

</div>

You can not plot vertical surfaces using `surface`, you’d need `mesh3d` for this:

```julia
using Plots
xp = [0, 0, 0, 0, 1, 1, 1, 1];
yp = [0, 1, 0, 1, 0, 0, 1, 1];
zp = [0, 0, 1, 1, 1, 0, 0, 1];
connections = [(1,2,3), (4,2,3), (4,7,8), (7,5,6), (2,4,7), (1,6,2), (2,7,6), (7,8,5), (4,8,5), (4,5,3), (1,6,3), (6,3,5)];

mesh3d(xp,yp,zp; connections, xlabel="x", proj_type = :persp, linecolor=:black)

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-plot-a-cube-in-3d-in-plots-jl/86919)._
