1

如何更改 Diagrammer 图表上的箭头类型?我想在同一张图上混合它们。

在此处输入图像描述

玩具示例:

library(data.table)
niv <- c("A","B","C","D","E","X","Y")
from <- c("A","A","A","A","B","C","D","E", "X", "B")
to <- c("B","C","D","E","X","X","Y","Y","Y", "C")
temp <- data.table(from=factor(from, levels=niv),
to=factor(to,levels=niv), col=c(rep("blue",5), rep("black",5)))

nodes <-   create_node_df(  n=length(niv), label=niv,  width=0.3) 
edges <- create_edge_df(from = temp$from, to = temp$to, 
rel = "leading_to", label=temp$from, color=temp$col)   
graph <- create_graph(  nodes_df = nodes, edges_df = edges)
render_graph(graph)

现在所有箭头都定义为 rel = "leading_to"。但我无法在文档中找到我可以使用的其他选项。

我想将该参数链接到我的数据表上的一个新列,指定我想要一个“to”箭头、一个“from”箭头,还是只画一条没有箭头的线。

有尾巴但没有头的箭头有哪些选择?
对于没有箭头的简单线条?

4

1 回答 1

1

我找到了一种使用参数的方法

arrowhead = myvector

我的向量有元素"none"和/或"normal"。这让我可以压制一些箭头。其他有趣的选项是invcrowhttps://rich-iannone.github.io/DiagrammeR/graphviz_and_mermaid.html

也许参数rel也有一个选项,但我找不到它。

于 2017-11-24T14:43:21.257 回答