Reputation: 1718
This might be too much to ask, but is it possible to color only part of the label text? For example, I have a vertex with 2-line label, and I want the first line in black font and the second line in red font. Anything can be done?
Many thanks!!
Upvotes: 0
Views: 432
Reputation: 7232
You can put the labels manually (if there is no other way).
library(igraph)
g1 <- graph.atlas(sample(0:1252, 1))
layout1 <- layout.fruchterman.reingold(g1)
plot(g1, layout = layout1)
layout2 <- apply(layout1, 2, function(x) {
x <- x / (max(x)-min(x))*2
x <- x - min(x) - 1
})
text(layout2[,1], layout2[,2], pos = 3, labels = letters[1:length(V(g1))], col ="red" )
Upvotes: 2