graphviz - Graphviz 中从左上到右下的树
问题描述
说我从这个开始:
graph {
graph [splines=ortho]
node [fontname="Sans-Serif" shape=record]
rankdir=LR
"Parent" -- "Child 1"
"Parent" -- "Child 2"
"Parent" -- "Child 3"
"Parent" -- "Child 4 and then some"
}
这产生:
我需要改变什么才能得到这个(等等后续级别)?
谢谢!
解决方案
出乎意料的困难。正交被 DIY 正交边缘取代,使用伪不可见节点。
graph {
// note: renaming the nodes was optional
graph [splines=false ] // was ortho
node [fontname="Sans-Serif" shape=rect ] // record features unused
rankdir=LR // ranks are now vertical!
{ // non-visible nodes (i1 i2 i3 i4) used to connect edges
rank=same
node [label="" peripheries=0] // keep same size as other nodes,
// but do not draw (peripheries)
edge [headclip=false tailclip=false] // draw center-to-center
i1:c -- i2:c -- i3:c -- i4:c
}
{node [group=T] P C1} //group used to place "child 1" w/ parent
P [label="Parent"]
{
rank=same
C1 [label="Child 1"]
C2 [label="Child 2"]
C3 [label="Child 3"]
C4 [label="Child 4 and then some"]
}
P -- i1 [headclip=false]
edge [tailclip=false]
i1 -- C1
i2 -- C2
i3 -- C3
i4 -- C4
}
推荐阅读
- r - 向ggplot直方图添加偏移标签
- c# - 从 Windows 8.1 Pro 获取磁盘性能值时出现 C# 问题
- iterator - 如何在 Rust 中的锁定结构成员上返回迭代器?
- r - 在 RMarkdown 中使用 papaja 和 tableone 时 as.data.frame.character(x, stringsAsFactors = FALSE, ...) 出错
- c++ - 尝试在 Mac 上使用 Eclipse 进行 c++ 项目
- javascript - 使用 CodeIgniter 获取下拉列表数据,但 Jquery 在提交时返回未定义的选定值
- ejb - 本地客户端是否传递了对 EJB LocalBean 的直接引用?
- ios - 如何在触摸时向 UITableViewCell 添加标签?
- javascript - HTML 自定义属性优先级
- c# - 普通 C# 和 Orleans 中的方法调用之间的区别