【发布时间】:2019-01-09 01:51:56
【问题描述】:
现状
在我之前的问题Data frame into a symmetric matrix while keeping all row and column 中,我最终得到了一个对称矩阵,我想将其转换为这样的格式化和弦图:
library(edgebundleR)
# data
x <- structure(c(1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0),
.Dim = c(3L,5L),
.Dimnames = list(c("a.X", "a.Y", "b.Z"), c("a.A", "a.B", "a.C", "b.D", "b.E")))
x <- as.matrix(x)
x <- rbind(cbind(diag(nrow(x)), x), cbind(t(x), diag(ncol(x))))
colnames(x) <- rownames(x)
# plot
edgebundle(x)
# plot with basic formatting using the arguments of edgebundle()
edgebundle(x,
tension=1,
fontsize = 12,
cutoff = 0,
width = 1000,
padding = 230,
nodesize = c(5, 30))
问题
但是,类似于Color edges and vertex in chord diagram using edgebundle,我想更进一步并更改线条和节点的颜色(默认情况下和鼠标悬停期间),这在使用 igraph-object 时是可能的,如@987654323 所示@ 和documentation。
在阅读了edgebundleR 的PDF-documentation 之后,我想这不是该软件包功能的一部分,但它也可以...
- 包括基于组
c("a.", "b.")的分组标签 - 更改文本的字体
- 对指向不同组的线条使用不同颜色 已选择类别(如 example 中的输入和输出)
- 为绘图添加标题,当绘图旋转时保持原位
我的问题
- 是否可以在使用 矩阵而不是 igraph 对象,优先使用颜色代码 (RGB,十六进制),如果是,如何?
- 尽管未包含在基本功能中,但是否有 从上面进行高级格式化的方法? (当然,不必在很大程度上重写或扩展包)
感谢您的建议!
【问题讨论】:
标签: r matrix plot chord-diagram