gpt4 book ai didi

r - 将文本添加到 R 中的 DiagrammeR 流程图流线

转载 作者:行者123 更新时间:2023-12-04 12:17:39 27 4
gpt4 key购买 nike

以下代码使用 DiagrammeR 包在 R 中创建流程图。如何向连接形状的流线添加"is"或“否”(或任何其他文本)?创建图表时,我的节点通常是决策,我想将流程线答案标记为是/否。

library(DiagrammeR)

grViz("
digraph boxes_and_circles {

# a 'graph' statement
graph [overlap = true, fontsize = 10]

# several 'node' statements
node [shape = box,
fontname = Helvetica]
A; B; C; D; E; F

node [shape = circle,
fixedsize = true,
width = 0.9] // sets as circles
1; 2; 3; 4; 5; 6; 7; 8

# several 'edge' statements
A->1 B->2 B->3 B->4 C->A
1->D E->A 2->4 1->5 1->F
E->6 4->6 5->7 6->7 3->8
}
")

Capture.png

最佳答案

尝试为每个流线定义标签,如下所示:

library(DiagrammeR)

grViz("
digraph boxes_and_circles {

# a 'graph' statement
graph [overlap = true, fontsize = 10]

# several 'node' statements
node [shape = box,
fontname = Helvetica]
A; B; C; D; E; F

node [shape = circle,
fixedsize = true,
width = 0.9] // sets as circles
1; 2; 3; 4; 5; 6; 7; 8

# several 'edge' statements
A->1 [label='YES']
B->2 [label='NO']
B->3 [label='...']
B->4 C->A
1->D E->A 2->4 1->5 1->F
E->6 4->6 5->7 6->7 3->8
}
")

希望能帮助到你! :)

关于r - 将文本添加到 R 中的 DiagrammeR 流程图流线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50293502/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com