# How to use Makie to visualize network data in 3D?

**URL:** <https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197>\
**Category:** General Usage\
**Tags:** plotting, visualization, makie\
**Created:** [May 15, 2021, 11:50am UTC](https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197 "2021-05-15T11:50:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junars](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junars/32/16094_2.png) [@Junars](https://discourse.julialang.org/u/Junars)\
**Post date:** [May 15, 2021, 11:50am UTC](https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197/1 "2021-05-15T11:50:15Z")

</div>

I have a custom node type and I want to be able to present data dynamically in real time. Maybe I should do it in another language？ Hope a simple example. Thx!!!

---

<div class="post-metadata">

**Author:** ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)\
**Post date:** [May 15, 2021, 9:33pm UTC](https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197/2 "2021-05-15T21:33:31Z")

</div>

I wonder if it’s possible to hook up one of the [graph plotting libraries](https://juliagraphs.org/LightGraphs.jl/latest/plotting/) to Makie.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [May 16, 2021, 10:32am UTC](https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197/3 "2021-05-16T10:32:07Z")

</div>

[GitHub - JuliaPlots/GraphMakie.jl: Plotting graphs with Makie](https://github.com/JuliaPlots/GraphMakie.jl) is currently actively developed by @hexaeder and is making great progress 🙂  
It’s still in alpha but already has quite a bit of functionality and docs!

---

<div class="post-metadata">

**Author:** ![Junars](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junars/32/16094_2.png) [@Junars](https://discourse.julialang.org/u/Junars)\
**Post date:** [May 16, 2021, 1:02pm UTC](https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197/4 "2021-05-16T13:02:07Z")

</div>

It seems that the answer is Yes! 🙂

---

<div class="post-metadata">

**Author:** ![Junars](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junars/32/16094_2.png) [@Junars](https://discourse.julialang.org/u/Junars)\
**Post date:** [May 16, 2021, 1:03pm UTC](https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197/5 "2021-05-16T13:03:31Z")

</div>

Thx! But it only support 2D visualization at current stage. I will study this package and try to do something with myself. 😁

---

<div class="post-metadata">

**Author:** ![hexaeder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hexaeder/32/24403_2.png) [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Post date:** [May 16, 2021, 1:32pm UTC](https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197/6 "2021-05-16T13:32:13Z")

</div>

Yes you’re right I havn’t focused on 3D layouts yet but I certainly will improve that area. There is a very small bug to fix for this, I am working on it.  
What do you mean by “custom node type”? Whicht type of data to you want to display? I am very interested to hear about real world use cases to develop GraphMakie further.

---

<div class="post-metadata">

**Author:** ![Junars](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junars/32/16094_2.png) [@Junars](https://discourse.julialang.org/u/Junars)\
**Post date:** [May 16, 2021, 1:44pm UTC](https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197/7 "2021-05-16T13:44:41Z")

</div>

I’m very excited to share my idea with you. Yes, what I want is to visualize a neural-like network(not CNN those things, but conceptual network). A thinking Brain! (I’m working on AGI)。  
Oh, so-called “my custom node type” is just a julia `struct` with some infomation. sorry for my poor english. 😅

---

<div class="post-metadata">

**Author:** ![hexaeder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hexaeder/32/24403_2.png) [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Post date:** [May 16, 2021, 2:07pm UTC](https://discourse.julialang.org/t/how-to-use-makie-to-visualize-network-data-in-3d/61197/8 "2021-05-16T14:07:14Z")

</div>

If you use the master branch of GraphMakie  
`] add https://github.com/JuliaPlots/GraphMakie.jl#master`  
you should be able to plot rudimentary 3d graphs now. It should work with any `layout` function which takes the adjacency matrix of the graph and returns a list of `Point3f0`.

```julia
using GLMakie
using GraphMakie
using LightGraphs

g = SimpleGraph(8)
add_edge!(g, 1, 2)
add_edge!(g, 2, 3)
add_edge!(g, 3, 4)
add_edge!(g, 4, 1)

add_edge!(g, 5, 6)
add_edge!(g, 6, 7)
add_edge!(g, 7, 8)
add_edge!(g, 8, 5)

add_edge!(g, 1, 5)
add_edge!(g, 2, 6)
add_edge!(g, 3, 7)
add_edge!(g, 4, 8)

cube = (adj_matrix) -> [Point3f0(0,0,0),
                        Point3f0(0,1,0),
                        Point3f0(1,1,0),
                        Point3f0(1,0,0),
                        Point3f0(0,0,1),
                        Point3f0(0,1,1),
                        Point3f0(1,1,1),
                        Point3f0(1,0,1)]

f, lscene, p = graphplot(g, layout=cube, node_size=30)

```

 ![Screenshot 2021-05-16 at 16.04.04](https://global.discourse-cdn.com/julialang/original/3X/b/e/be1ba2dc3caafe830fb25905dc75b739fd4d3865.png)

For more featurers I have to read up on some 3D plotting with makie…
