Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change the font and colour of the title of the igraph

Tags:

r

igraph

I am building an igraph and like to be able to change the color and font size of the title of the graph.

dput(df)
structure(list(Month = structure(c(15248, 15522), class = "Date"), 
    Value = c(1, 3)), .Names = c("Month", "Value"), row.names = 1:2, class = "data.frame")

g <- graph.data.frame(df)

 plot(g, layout =  layout.kamada.kawai,  vertex.label = V(g)$name,  vertex.label.color= "white",edge.arrow.size=0.5,  edge.curved=T, edge.label=E(g)$Freq, edge.label.color="pink", edge.label.font=5,vertex.shape="circle",edge.color="white", vertex.color="red", asp=0, main="This is my first igraph")
like image 521
user1471980 Avatar asked Jan 04 '13 20:01

user1471980


1 Answers

Remove argument main="..." from function plot() and after plot(...) use function title() where cex.main= sets size and cex.col= sets colour.

plot(g, layout =  layout.kamada.kawai,  vertex.label = V(g)$name,  vertex.label.color= "white",edge.arrow.size=0.5,  edge.curved=T, edge.label=E(g)$Freq, edge.label.color="pink", edge.label.font=5,vertex.shape="circle",edge.color="white", vertex.color="red", asp=0)
title("This is my first igraph",cex.main=3,col.main="green")
like image 73
Didzis Elferts Avatar answered Nov 07 '22 09:11

Didzis Elferts