# Package for visualizing wireframe cube

**URL:** <https://discourse.julialang.org/t/package-for-visualizing-wireframe-cube/54400>\
**Category:** Visualization\
**Created:** [February 1, 2021, 6:02pm UTC](https://discourse.julialang.org/t/package-for-visualizing-wireframe-cube/54400 "2021-02-01T18:02:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![EL-Bakkali-Jaafar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/el-bakkali-jaafar/32/21412_2.png) [@EL-Bakkali-Jaafar](https://discourse.julialang.org/u/EL-Bakkali-Jaafar)\
**Post date:** [February 1, 2021, 6:02pm UTC](https://discourse.julialang.org/t/package-for-visualizing-wireframe-cube/54400/1 "2021-02-01T18:02:47Z")

</div>

Hi all,  
What I am looking for is a package to draw a wireframe cube and to draw segment connecting two 3d points.

Thanks.

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [February 1, 2021, 6:52pm UTC](https://discourse.julialang.org/t/package-for-visualizing-wireframe-cube/54400/2 "2021-02-01T18:52:33Z")

</div>

[Makie](http://makie.juliaplots.org/stable/) can do it.

```julia
# to display the plot
using GLMakie

scene=wireframe(FRect3D(Point3f0(-1,-1,-1), Point3f0(2,2,2)))
scatterlines!([0,sqrt(2)], [0,sqrt(2)],[0,sqrt(2)])

# to save the plot to a file
using CairoMakie
CairoMakie.activate!()
save("plot.png", scene)

```

![plot](https://global.discourse-cdn.com/julialang/original/3X/8/f/8fb9a463a850a3fb36abc75f271d2172fdc272a1.png)

---

<div class="post-metadata">

**Author:** ![EL-Bakkali-Jaafar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/el-bakkali-jaafar/32/21412_2.png) [@EL-Bakkali-Jaafar](https://discourse.julialang.org/u/EL-Bakkali-Jaafar)\
**Post date:** [February 2, 2021, 4:46pm UTC](https://discourse.julialang.org/t/package-for-visualizing-wireframe-cube/54400/3 "2021-02-02T16:46:01Z")

</div>

Thank you Contradict for your solution it seems good and easy.

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [February 2, 2021, 5:21pm UTC](https://discourse.julialang.org/t/package-for-visualizing-wireframe-cube/54400/4 "2021-02-02T17:21:09Z")

</div>

I didn’t know CairoMakie supported 3D plots! The [homepage](https://github.com/JuliaPlots/CairoMakie.jl) says only 2D plots are supported…

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 2, 2021, 8:26pm UTC](https://discourse.julialang.org/t/package-for-visualizing-wireframe-cube/54400/5 "2021-02-02T20:26:27Z")

</div>

As far as I see CairoMakie is only used to save a .png file, not for creating the 3D plot…

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [February 2, 2021, 8:39pm UTC](https://discourse.julialang.org/t/package-for-visualizing-wireframe-cube/54400/6 "2021-02-02T20:39:24Z")

</div>

After some more experimentation, I’m not sure how this all works.

The call to `save` works fine without `using CairoMakie`.

In addition, I can create and save the plot only using `CairoMakie` (no visualization of course), but I haven’t figured out how to adjust the viewpoint.

---

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [February 3, 2021, 3:41pm UTC](https://discourse.julialang.org/t/package-for-visualizing-wireframe-cube/54400/7 "2021-02-03T15:41:37Z")

</div>

Just found that the [Backends & Output](http://makie.juliaplots.org/dev/backends_and_output.html#Z-Order) docs actually mention limited support for 3D in CairoMakie:

> CairoMakie as a 2D engine has no concept of z-clipping, therefore its 3D capabilities are quite limited. The z-values of 3D plots will have no effect and will be projected flat onto the canvas. Z-layering is approximated by sorting all plot objects by their z translation value before drawing, after that by parent scene and then insertion order. Therefore, if you want to draw something on top of something else, but it ends up below, try translating it forward via `translate!(obj, 0, 0, some_positive_z_value)` .
