# How to show edges in mesh plot in Makie?

**URL:** https://discourse.julialang.org/t/how-to-show-edges-in-mesh-plot-in-makie/61820
**Category:** Visualization
**Tags:** mesh, makie
**Created:** [May 25, 2021, 10:33pm UTC](https://discourse.julialang.org/t/how-to-show-edges-in-mesh-plot-in-makie/61820 "2021-05-25T22:33:34Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)
#### Post date: [May 25, 2021, 10:33pm UTC](https://discourse.julialang.org/t/how-to-show-edges-in-mesh-plot-in-makie/61820/1 "2021-05-25T22:33:34Z")

</div>

From the documentation, it is easy to plot a mesh given an array of coordinates and an array of connectivities:

```julia
using GLMakie

coords = [
  0.0 0.0
  1.0 0.0
  1.0 1.0
  0.0 1.0
]

connec = [
  1 2 3
  3 4 1
]

mesh(coords, connec)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/8/e897fad2d9613fcca42984a6c770857e800240ea.png)

Is there an attribute to also show the wireframe? I am trying to show the edges of the triangles in black color for example.

---

<div class="post-metadata">

### Author: ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)
#### Post date: [May 26, 2021, 2:40am UTC](https://discourse.julialang.org/t/how-to-show-edges-in-mesh-plot-in-makie/61820/2 "2021-05-26T02:40:52Z")

</div>

I got this to work, but I don’t know if that is enough?  
The wireframe! method expects a “mesh” object, which I think is built in the call to mesh, you could extract that mesh from inside the mesh plot.

```julia
julia> coords = [
         0.0 0.0
         1.0 0.0
         1.0 1.0
         0.0 1.0
       ]

julia> connec = [
         1 2 3
         3 4 1
       ]

julia> a = mesh(coords,connec)

julia> wireframe!(a.axis,a.plot[1][], color=:black)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/f/af221a9565539c4d7f3cdd02e3c3d4f7baceaaa0.png)

---

<div class="post-metadata">

### Author: ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)
#### Post date: [May 26, 2021, 10:40am UTC](https://discourse.julialang.org/t/how-to-show-edges-in-mesh-plot-in-makie/61820/3 "2021-05-26T10:40:04Z")

</div>

Thank you @aramirezreyes , but I am wondering if it is possible to use an attribute instead. Perhaps it is not possible currently.

---

<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 26, 2021, 10:44am UTC](https://discourse.julialang.org/t/how-to-show-edges-in-mesh-plot-in-makie/61820/4 "2021-05-26T10:44:35Z")

</div>

You can use:

```julia
poly(coords, connec, strokewidth=1, shading=true)

```

---

<div class="post-metadata">

### Author: ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)
#### Post date: [May 26, 2021, 11:03am UTC](https://discourse.julialang.org/t/how-to-show-edges-in-mesh-plot-in-makie/61820/5 "2021-05-26T11:03:15Z")

</div>

Nice, I will give it a try. Could you please explain the main differences between poly and mesh? I was assuming that the mesh command was the main command for plotting meshes.

---

<div class="post-metadata">

### Author: ![jlchan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlchan/32/10958_2.png) [@jlchan](https://discourse.julialang.org/u/jlchan)
#### Post date: [May 26, 2021, 5:13pm UTC](https://discourse.julialang.org/t/how-to-show-edges-in-mesh-plot-in-makie/61820/6 "2021-05-26T17:13:47Z")

</div>

It looks like the behavior is more general than `mesh`. From the docstrings

> Plots a polygon based on the arguments given. When vertices and indices are given, it functions similarly to mesh. When points are given, it draws one polygon that connects all the points in order. When a shape is given (essentially anything decomposable by GeometryBasics), it will plot decompose(shape).

Tried both and seems like the `strokewidth` keyword works for `poly` but not `mesh`.

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [May 26, 2021, 6:19pm UTC](https://discourse.julialang.org/t/how-to-show-edges-in-mesh-plot-in-makie/61820/7 "2021-05-26T18:19:32Z")

</div>

Poly is mesh plus wireframe
