[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] Adjusting vertex label positions in igraph plot
From: |
Michael Gruenstaeudl |
Subject: |
[igraph] Adjusting vertex label positions in igraph plot |
Date: |
Mon, 12 Feb 2018 13:59:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
Dear igraph users,
I am using the igraph to visualize the association between the two
variables (s and g).
In shell:
$ cat file
s g
s1 foo bar
s2 foo bar baz qux
s99 foo
s9999 foo bar baz qux
s99999 foo
s999999 foo
In R:
m <- as.matrix(read.table(file="~/path_to_file/file", sep="\t", header=T))
g <- graph_from_edgelist(m)
V(g)$type <- bipartite.mapping(g)$type
coords <- layout_as_bipartite(g)
plot.igraph(g, layout = -coords[,2:1],
vertex.shape="rectangle",
vertex.size=10,
vertex.size2=1,
vertex.color=NA,
vertex.frame.color=NA,
vertex.label.color="black",
vertex.label.family="sans",
edge.label.color="white",
edge.arrow.mode=0,
edge.width=3,
asp=5)
However, the resulting visualization has the vertex labels and the edges
overlap, making the labels difficult to read. For an example, see:
https://pasteboard.co/H7ixdKx.png
I would like to adjust the R code such that all vertex labels are moved
away from the vertex center (i.e., vertex labels of s moved to left,
vertex labels of g moved to right) and that all vertex labels are
left-aligned (and not centered, as is the default case).
Can I do that via igraph and if so, how?
Best, Michael Gruenstaeudl
Michael Grünstäudl (Gruenstaeudl), PhD
Freie Universität Berlin
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [igraph] Adjusting vertex label positions in igraph plot,
Michael Gruenstaeudl <=