Buthetleon
Buthetleon

Reputation: 1305

variable vertex font size in igraph

Is it possible have vertex labels of variable font sizes. labelling certain nodes with a bigger font size than others

g1 <- erdos.renyi.game(20, 2/20)
V(g1)$name<-letters[1:vcount(g1)]
plot(g1,vertex.label=V(g1)$name)

Understand there is a vertex.label.cex option in igraph.plot but it is global.

Upvotes: 3

Views: 25669

Answers (2)

Buthetleon
Buthetleon

Reputation: 1305

Yes you're right Tyler, my bad. Added an example to the question

And your solution would be something like this?

V(g1)$label.cex = 1
V(g1)$label.cex[1:20 %% 2 == 0] = 0.5

does this method apply to all vertex and edge attributes as well?

Upvotes: 4

Tyler Rinker
Tyler Rinker

Reputation: 110044

Yes it is possible. V(g)$label.cex is what you're after. See this blog post of mine for an example how: http://trinkerrstuff.wordpress.com/2012/06/30/igraph-and-sna-an-amateurs-dabbling/

May I suggest next post you provide a reproducible example and you'll likely get much better assistance.

Upvotes: 10

Related Questions