How to force the layout_with_lgl in igraph for R to place the root node at the bottom center position of the canvas?

Dear community, I need some help :wink:

I am trying to display a directed tree graph (from root to leaves) by using igraph in R. I tried layout_as_tree (I didn’t like this aesthetically) and others. I liked layout_with_lgl best and decided to use this for further optimization.

Because I am interested in naturally looking structures, I would like to initialize the root node at the bottom center of the canvas before layout is generated. I have seen in the igraph manual, that in layout_with_lgl the root node is positioned per default in the middle of the canvas. Can this be changed?

# building the data
data <- data.frame(
  group1 = c(rep("A",8),rep("B", 12), rep("C",15), rep("D", 5)),
  group2 = rep(c("E", "F", "G", "H"), each = 10),
  group3 = rep(c("I", "J", "K", "L", "M", "N", "O", "P", "Q", "R"), each = 4),
  group4 = seq(1,40),
  value = abs(rnorm(40)*10)
)

library(treemap)
# building a treegraph g
g <- treegraph(data[,1:4],
               directed = TRUE,
               show.labels = TRUE,
               rootlabel = "root",
               vertex.label.cex = 0.8,
               vertex.label.family = "sans")


# generating the lgl layout
set.seed(3)
library("igraph")
l = layout_with_lgl(g,
                    maxiter = 1000,
                    maxdelta = vcount(g),
                    area = vcount(g)^2,
                    coolexp = 3,
                    repulserad = vcount(g)^2 * vcount(g),
                    cellsize = 2*vcount(g)^2,
                    root = 1)

plot(g,
     vertex.label = NA,
     vertex.size = 5,
     edge.width = 5,
     edge.arrow.size = 0,
     edge.curved = 0.15,
     layout = l)

Thanx in advance