0

私はこのデータフレームを持っています:

dput(df2)

structure(list(Receiver = structure(c(4L, 3L, 2L, 1L), .Label = c("Australia", 
"United Arab Emirates", "United Kingdom", "United States of America"
), class = "factor"), Sender = structure(c(1L, 1L, 1L, 1L), .Label = "United States of America", class = "factor")), .Names = c("Receiver", 
"Sender"), row.names = c(NA, -4L), class = "data.frame")

私はこのように描画してigraphしたいと思います:

library(igraph)
g<-graph.data.frame(df2)
plot(g, layout = layout.kamada.kawai,  vertex.label = V(g)$name,  
     vertex.label.color= "red",  edge.arrow.size=0.8,  
      edge.curved=T, edge.label.color="white",                              
      edge.label.cex=0.8,vertex.shape="circle",edge.color="pink",
      vertex.color="lightblue", asp=0, margin=0)

頂点のサイズを大きくせずに、頂点ラベルを頂点内に表示したいと思います。どうすればこれを行うことができますか?

4

2 に答える 2

2

コール プロットの前に次のようなことができます。

  V(g)$label.cex <- 0.5

しかし、名前のショートカットを使用しないのはなぜですか?

 V(g)$name<-c('USA','UK','UAE','Aus')

ここに画像の説明を入力

dat <- structure(list(Receiver = structure(c(4L, 3L, 2L, 1L), .Label = c("Australia", 
                                                                  "United Arab \nEmirates", "United \nKingdom", "United \nStates of \nAmerica"
), class = "factor"), Sender = structure(c(1L, 1L, 1L, 1L), .Label = "United \nStates of \nAmerica", class = "factor")), .Names = c("Receiver", 
                                                                                                                                "Sender"), row.names = c(NA, -4L), class = "data.frame")


library(igraph)
g<-graph.data.frame(dat)
V(g)$label.cex <- 0.6
plot(g, layout = layout.kamada.kawai,  vertex.label = V(g)$name,  
     vertex.label.color= "red",  edge.arrow.size=0.8,  
     edge.curved=T, edge.label.color="white",                              
     edge.label.cex=0.8,vertex.shape="circle",edge.color="pink",
     vertex.color="lightblue", asp=0, margin=0)
于 2013-01-11T14:47:48.783 に答える