Harjeet Singh Bariar
Harjeet Singh Bariar

Reputation: 130

how to increase length of edges when plotting a graph in R

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

Upvotes: 6

Views: 5211

Answers (1)

desc
desc

Reputation: 1210

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)

Upvotes: 6

Related Questions