# Maths formulas or symbols for labelling edges or vertices

**URL:** <https://igraph.discourse.group/t/maths-formulas-or-symbols-for-labelling-edges-or-vertices/1777>\
**Category:** Usage\
**Tags:** R\
**Created:** [9 March 2024 11:10 UTC](https://igraph.discourse.group/t/maths-formulas-or-symbols-for-labelling-edges-or-vertices/1777 "2024-03-09T11:10:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gypaetus\_barbatus](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@Gypaetus\_barbatus](https://igraph.discourse.group/u/Gypaetus_barbatus)\
**Post date:** [9 March 2024 11:10 UTC](https://igraph.discourse.group/t/maths-formulas-or-symbols-for-labelling-edges-or-vertices/1777/1 "2024-03-09T11:10:03Z")

</div>

Hi,  
as explained in the title I would like to label the edges or vertices using maths symbols, such as those given by latex2exp.

Is it possible ?  
Thank you in advance  
René

---

<div class="post-metadata">

**Author:** ![tamas](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/tamas/32/1261_2.png) [@tamas](https://igraph.discourse.group/u/tamas)\
**Post date:** [13 March 2024 17:07 UTC](https://igraph.discourse.group/t/maths-formulas-or-symbols-for-labelling-edges-or-vertices/1777/2 "2024-03-13T17:07:35Z")

</div>

In R, Python, Mathematica or some other language?

---

<div class="post-metadata">

**Author:** ![Gypaetus\_barbatus](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@Gypaetus\_barbatus](https://igraph.discourse.group/u/Gypaetus_barbatus)\
**Post date:** [17 March 2024 20:54 UTC](https://igraph.discourse.group/t/maths-formulas-or-symbols-for-labelling-edges-or-vertices/1777/3 "2024-03-17T20:54:47Z")

</div>

HI,

As a starting point, my question was for R. I found solutions with Latex and package tikz that are promising. I keep on being intersted by solutions with R.  
Thank you

---

<div class="post-metadata">

**Author:** ![maelle](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/maelle/32/1047_2.png) [@maelle](https://igraph.discourse.group/u/maelle)\
**Post date:** [18 March 2024 12:01 UTC](https://igraph.discourse.group/t/maths-formulas-or-symbols-for-labelling-edges-or-vertices/1777/4 "2024-03-18T12:01:04Z")

</div>

👋 @Gypaetus_barbatus

What seems promising is using the ggraph package together with latexexp. An example below, that I created by mixing [Edges • ggraph](https://ggraph.data-imaginist.com/articles/Edges.html) and the latexexp docs.

```r
library("ggraph")
#> Loading required package: ggplot2
library("tidygraph")
#> 
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#> 
#> filter
library("latex2exp")
simple <- create_notable('bull') |> 
  mutate(name = c('Thomas', 'Bob', 'Hadley', 'Winston', 'Baptiste')) |> 
  activate(edges) |> 
  mutate(type = sample(c('friend', 'foe'), 5, TRUE))

ggraph(simple, layout = 'graphopt') + 
  geom_edge_link(aes(label = type), 
                 angle_calc = 'along',
                 label_dodge = unit(2.5, 'mm'),
                 arrow = arrow(length = unit(4, 'mm')), 
                 end_cap = circle(3, 'mm')) + 
  geom_node_point(size = 5) +
  ggtitle(TeX(r'(Using $\LaTeX$ for plotting in ggplot2. I $\heartsuit$ ggplot!)'))

```

![](https://global.discourse-cdn.com/free1/uploads/igraph/original/2X/a/aa3bc24f1333516c406b4904dd582c0eeb5ca995.png)

Created on 2024-03-18 with [reprex v2.1.0](https://reprex.tidyverse.org)

---

<div class="post-metadata">

**Author:** ![Gypaetus\_barbatus](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@Gypaetus\_barbatus](https://igraph.discourse.group/u/Gypaetus_barbatus)\
**Post date:** [19 March 2024 12:44 UTC](https://igraph.discourse.group/t/maths-formulas-or-symbols-for-labelling-edges-or-vertices/1777/5 "2024-03-19T12:44:37Z")

</div>

Hi Maelle,

thank you for your reply. I see you use latex in the title. Would it be possible to use it to label the edges, for example having \theta\_k^i instead of ‘foe’ ?
