我正在尝试使用以下代码绘制3D网络图。
rm(list = ls(all=TRUE))
graphics.off()
library(readxl)
library(igraph)
library(threejs)
NTWVD <- read_excel("C:/Users/Mihan/Dropbox/DataCamp/R/Network_Analysis/NTWVD.xlsx")
NT.mat<-as.matrix(NTWVD)
NT1.mat<-NT.mat[,1:2]
g<-graph.edgelist(NT1.mat, directed=FALSE)
g<-set_vertex_attr(g, "color", value=c("red","blue","green","red","green","red","green","green","green","green","green","yellow","yellow","yellow","yellow","yellow","blue","yellow","red","black","black","black","black","black","black","red","red","blue","blue","blue","blue"))
graphjs(g,vertex.size = 1, showLabels=TRUE)
graphjs(g, main = "", curvature = 0, bg = "white",
fg = "black", showLabels = TRUE, attraction = 1, repulsion = 1,
max_iterations = 1500, opacity = 1, stroke = TRUE, width = NULL,
height = NULL)
我有一个漂亮的互动情节。但我没有在顶点上看到任何标签。我在这个数据中有两列。顶点1和顶点2。 请告知我如何在图中的顶点上显示标签?
答案 0 :(得分:1)