# [R] igraph: layout help

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Sat Jun 11 15:56:54 CEST 2022

```Hello,

The code below is a hack.
First I create a layout ll, then see that vertex K coordinates are in
the layout matrix 2nd row.

Now, to multiply K's coordinates by a number d>1 will move the point
away from A. Add that value to the K group and plot.

ll <- layout_with_kk(my.graph)
d <- ll[2, ]*5
ll[c(2, 9:11), ] <- t(t(ll[c(2, 9:11), ]) + d)

plot(my.graph, layout = ll)

Hope this helps,

Às 19:20 de 10/06/2022, Brian Smith escreveu:
> Hi,
>
> I was trying to make a network plot of this data:
>
> ============
> library(igraph)
> library(network)
>
> df1 <- data.frame(from="A",to=c("B","C","D","E","F","G"),value=1)
> df2 <- data.frame(from="K",to=c("L","M","N"),value=1)
> df3 <- data.frame(from="A",to="K",value=3)
> my.df <- rbind(df1,df2,df3)
>
> my.graph <- graph_from_data_frame(my.df,directed = F)
> plot(my.graph)
> ============
>
> What I wanted was for nodes A to G to be very close together (touching each
> other). Similarly, nodes K to N should be very close together. The
> connecting edge (A to K) between these sets of points/vertices should be
> the only edge visible. How should I go about doing this?
>
> Also, how can I change the parameters (node label, node color, etc.) of the
> graph?
>
> Any help or link to documentation would be helpful. Or would
>
> thanks!
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.

```