R-sankey

来源:互联网 发布:男士搭配软件 编辑:程序博客网 时间:2024/05/21 09:20


library(networkD3)


setwd("D:/Users/GESHENGLI216/Desktop/R/sankeycsvtou")


Nodes <- read.table("Nodes.csv")


names(Nodes) <- c("nodes")


Links <- read.table("Links.csv",sep = ",")


names(Links) <- c("source","target","value")


#sankeyNetwork(Links = Links, Nodes = Nodes, Source = "source",
#              Target = "target", Value = "value", NodeID = "nodes",
#              fontSize = 12, nodeWidth = 30 ,height ="1500px",width = "3000px")


library(magrittr)


sankeyNetwork(Links = Links, Nodes = Nodes, Source = "source",
              Target = "target", Value = "value", NodeID = "nodes",
              fontSize = 8, nodeWidth = 30,height ="1200px",width = "1800px")%>%
  
  saveNetwork(file = 'Net2.html')
0 0
原创粉丝点击