# GraphPlot how to color edges?

**URL:** https://discourse.julialang.org/t/graphplot-how-to-color-edges/17519
**Category:** General Usage
**Tags:** plotting
**Created:** [November 14, 2018, 2:42pm UTC](https://discourse.julialang.org/t/graphplot-how-to-color-edges/17519 "2018-11-14T14:42:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)
#### Post date: [November 14, 2018, 2:42pm UTC](https://discourse.julialang.org/t/graphplot-how-to-color-edges/17519/1 "2018-11-14T14:42:11Z")

</div>

Dear all,  
Here is the code that almost works:

```julia
using LightGraphs
using GraphPlot
using Colors

# nodes membership
membership = [1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,2,1,1,2,1,2,1,2,1,1,1,1,2,1,1,2,1,1,1]
nodecolor = [colorant"lightgrey", colorant"orange"]
# membership color
nodefillc = nodecolor[membership]
gplot(g, nodefillc=nodefillc, layout=circular_layout)

```

I would like to emphasize connection between orange nodes, so the end result should be something like this:

 ![discourse_example](https://global.discourse-cdn.com/julialang/original/3X/b/e/be941ed097d8ffe6a78c9e0bfa91dbd82d7f22e2.png)

How to do it?

---

<div class="post-metadata">

### Author: ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)
#### Post date: [November 14, 2018, 9:10pm UTC](https://discourse.julialang.org/t/graphplot-how-to-color-edges/17519/2 "2018-11-14T21:10:59Z")

</div>

Have you tried `edgestrokec` ?

> `edgestrokec`  
> Optional. Color for the edge strokes, can be a Vector. Default: `colorant"lightgray"`

---

<div class="post-metadata">

### Author: ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)
#### Post date: [November 15, 2018, 6:15am UTC](https://discourse.julialang.org/t/graphplot-how-to-color-edges/17519/3 "2018-11-15T06:15:26Z")

</div>

I tried but I couldn’t figure the right size of the vector. Actually, I posted the example code in the hope that someone could show how to build the vector.

---

<div class="post-metadata">

### Author: ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)
#### Post date: [November 15, 2018, 2:30pm UTC](https://discourse.julialang.org/t/graphplot-how-to-color-edges/17519/4 "2018-11-15T14:30:14Z")

</div>

I figured it out. Here is the final code:

```julia
using LightGraphs
using GraphPlot
using Colors

g = graphfamous("karate")

membership = [1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,2,1,1,2,1,2,1,2,1,1,1,1,2,1,1,2,1,1,1]
nodecolor = [colorant"lightgrey", colorant"orange"]
nodefillc = nodecolor[membership]

colors = [colorant"lightgray" for i in 1:78]
colors[42] = colorant"orange"

gplot(g, nodefillc=nodefillc, layout=circular_layout, edgestrokec=colors, edgelabel=1:78)

```

 ![Capture](https://global.discourse-cdn.com/julialang/original/3X/1/3/13f40a7ad8e010d9c9379680e2431e1904e1da26.png)
