4
votes

Is there a way to plot a graph in r with bigger edge lengths? I am simply using

library(igraph)

plot(graph)

and do anybody knows why all the edges have variable length?

**    V1    V2
1      6     1
2      6     5
3      1     0
4      1     6
5      1   385
6      5     4
7      5     6
8      5    98
9      0     1
10     0     2

I have data in this format and I am generating a network graph.

Click this link to see the graph

1
Do you mean the margins beside the plot?user 123342
no I mean the length of lines connecting two nodes?Harjeet Singh Bariar
Provide a rep. example.user 123342
i wanted to post the picture but the website does not allows me to do soHarjeet Singh Bariar
A picture won't help. Copy and paste a minimal example your code if you want a suggestion.user 123342

1 Answers

5
votes

You could try a few things:

You could change the margins on your plot:

par(mar=c(0,0,0,0))
plot(graph)

You could change the layout parameters by exploring the igraph documentation on layouts to do things like:

test.layout <- layout_(g,with_dh(weight.edge.lengths = edge_density(g)/1000))
plot(g, layout = test.layout)