在graphviz中记录节点和rankdir [英] record nodes and rankdir in graphviz

查看:226
本文介绍了在graphviz中记录节点和rankdir的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将图表的Rankdir从LR更改为TD时,我的记录节点也更改了其布局方向,因此它们不再看起来像记录".我尝试将单独的rankdir应用于节点,但这没有效果.

When I changed the rankdir of my graph from LR to TD, my record nodes also changed their layout direction so they no longer look like a 'record'. I tried applying a separate rankdir to the nodes, but this had no effect.

如何使记录节点具有正确的布局?

How does one keep the record nodes with the correct layout?

digraph sample { 
  graph [rankdir=TD];
  node [shape=record];

  A [label="ShouldBeTop | ShouldBeBottom"];
  B [label="Top | Bottom"];
  A -> B;
}

推荐答案

考虑到rankdir有效地替换了给定图形的顶部"和底部"的概念,这并不奇怪.

Taking into account that rankdir effectively replaces the notion of "top" and "bottom" for the given graph, that's not surprising.

恐怕对此没有简单的补救方法,除非黑客窃取了源代码(这根本不是一件容易的事).您可以使用某种大规模搜索替换解决方案在"{}"中加上标签,以获得所需的效果:

I am afraid that there is no easy remedy for this, save hacking the source (and that would not be easy at all). You can surround your labels in "{}" with some kind of mass search-replace solution to get the requested effect:

digraph sample { graph [rankdir=TD]; node [shape=record];

A [label="{ShouldBeTop | ShouldBeBottom}"]; 
B [label="{Top | Bottom}"]; A -> B; 
}

这篇关于在graphviz中记录节点和rankdir的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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