# Plotting graphs, using GraphPlot

**URL:** https://discourse.julialang.org/t/plotting-graphs-using-graphplot/30973
**Category:** Graphs
**Tags:** lightgraphs, visualization, graphs
**Created:** [November 11, 2019, 10:33pm UTC](https://discourse.julialang.org/t/plotting-graphs-using-graphplot/30973 "2019-11-11T22:33:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![marinarrd](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@marinarrd](https://discourse.julialang.org/u/marinarrd)
#### Post date: [November 11, 2019, 10:33pm UTC](https://discourse.julialang.org/t/plotting-graphs-using-graphplot/30973/1 "2019-11-11T22:33:47Z")

</div>

Hello,  
I would like to draw a graph with node and edge labels. I am stuck as when I call gplot no edges appear in my graph. I attatched an image of my graph as well as what I would like

```julia
using LightGraphs
using GraphPlot
using Compose
g = SimpleGraph(5)
add_edge!(g,1,3)
gplot(g)

```

![26%20PM](https://global.discourse-cdn.com/julialang/original/3X/6/e/6ee8b56ccac3d4923a645bd576cd89cc8bb04c69.png)

 ![Image-1](https://global.discourse-cdn.com/julialang/original/3X/1/2/12eb867e2d2fd1ff13052a2c76a2efe72b286b61.png)

---

<div class="post-metadata">

### Author: ![rad1um](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rad1um/32/8483_2.png) [@rad1um](https://discourse.julialang.org/u/rad1um)
#### Post date: [November 12, 2019, 7:08am UTC](https://discourse.julialang.org/t/plotting-graphs-using-graphplot/30973/2 "2019-11-12T07:08:18Z")

</div>

gplot sometimes shows edges a bit weird, but you have an edge between the close nodes on the top right. If you want to label your nodes/edges you can do that with

```julia
g = graphfamous("karate")

labels_edge = collect(1:ne(g))
labels_node = collect(1:nv(g))

gplot(g,
    nodelabel = labels_node,
    edgelabel = labels_edge)

```

---

<div class="post-metadata">

### Author: ![marinarrd](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@marinarrd](https://discourse.julialang.org/u/marinarrd)
#### Post date: [November 12, 2019, 4:12pm UTC](https://discourse.julialang.org/t/plotting-graphs-using-graphplot/30973/3 "2019-11-12T16:12:10Z")

</div>

> [@rad1um](#):
>
> labels\_edge = collect(1:ne(g)) labels\_node = collect(1:nv(g)) gplot(g, nodelabel = labels\_node, edgelabel = labels\_edge)

Can we change the labels to be something else?

---

<div class="post-metadata">

### Author: ![rad1um](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rad1um/32/8483_2.png) [@rad1um](https://discourse.julialang.org/u/rad1um)
#### Post date: [November 12, 2019, 6:21pm UTC](https://discourse.julialang.org/t/plotting-graphs-using-graphplot/30973/4 "2019-11-12T18:21:41Z")

</div>

Sure. Try an array with the length of the total number of edges containig your desired edge labels:

```julia
labels_edge = ["my", "edge", "labels",...,"foo", "bar"]

```
