Last active
August 29, 2015 14:00
-
-
Save ksomemo/11283979 to your computer and use it in GitHub Desktop.
有向グラフ(座標あり)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(igraph) | |
| #エッジ | |
| d <- data.frame(read.delim( | |
| "./relation.tsv", | |
| sep="\t", | |
| stringsAsFactors=FALSE, | |
| header=FALSE, | |
| na.strings="" | |
| ), stringsAsFactors=FALSE) | |
| #ノード | |
| vers <- data.frame(c(1:93), stringsAsFactors=FALSE) | |
| #グラフの作成 | |
| g <- graph.data.frame(d, directed=TRUE, vertices=vers) | |
| #ノード座標(x, y) | |
| # 左下(0,0) 右上(x, y) | |
| # ブラウザとY座標の取り方違うので、負の数にして調整 | |
| lay <- as.matrix(read.delim( | |
| "./position.tsv", | |
| sep="\t", | |
| stringsAsFactors=FALSE, | |
| header=FALSE, | |
| na.strings="" | |
| )) | |
| #プロット | |
| plot(g, layout=lay, vertex.label=V(g)$name) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO
右に90度回転すると求めているものになるので調査