在Graphviz中,如何将边缘与节点的顶部中心对齐? [英] In Graphviz, how do I align an edge to the top center of a node?

查看:94
本文介绍了在Graphviz中,如何将边缘与节点的顶部中心对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Graphviz/点中,是否可以使边缘精确地连接在节点的顶部中心?阅读点指南后,我认为tailportheadport会对我有所帮助,但是添加这些并没有什么不同,有时会使我产生更奇怪的结果.

In Graphviz / dot, is it possible to get the edge to connect exactly in the top center of a node? Reading the dot guide, I thought tailport and headport would help me, but adding those make no difference and sometimes get me weirder results.

这就是我得到的:

这就是我想要的:

我用来获取(不正确的)图形的代码是:

The code I used to get the (incorrect) graph is:

digraph G {

  graph [splines = ortho];
  node [shape = box];
  edge [dir = none];

  {
    rank = same

    A
    AB [shape = point]
    B

    A -> AB
    AB -> B
  }

  {
    rank = same
    point1 [shape = point]
    point2 [shape = point]
    point3 [shape = point]
  }

  AB -> point1

  // The following section if to make the nodes appear in 
  // the correct order, not sure if there's a better way
  {
    edge [style = invisible]
    rank = same
    C
    D
    E
    F
    C -> D
    D -> E
  }

  point2 -> point1
  point2 -> C
  point1 -> point3
  point3 -> E
  point1 -> D

}

推荐答案

原来最新版本(2.38)在Mac OS X Yosemite中无法正常工作,我不得不降级为2.36,如下载页面.

Turns out the most recent (2.38) version isn't working properly in Mac OS X Yosemite, I had to downgrade to 2.36 as noted in the download page.

这篇关于在Graphviz中,如何将边缘与节点的顶部中心对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆