节点的xlabel与点的边缘重叠 [英] xlabels for nodes overlap with edges in dot

查看:82
本文介绍了节点的xlabel与点的边缘重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用点来绘制图形,但是我遇到以下问题

I try to use dot for drawing a graph, and I have the following problem

节点b的标签与ab的边缘重叠.有没有办法以某种方式移动此标签来避免这种情况?

The label for node b overlaps with the edge from a to b. Is there a way to move this label somehow to avoid this?

这是我用来生成图像的代码(使用dot)

This is the code I use to generate the image (using dot)

digraph A {
  rankdir=LR;
  center=true; margin=0.3; 
  nodesep=1.5; ranksep=0.5;

  node [shape=point,  height=".2", width=".2"];

  a [xlabel="a"];
  b [xlabel="b"];
  c [xlabel="c"];
  a -> b -> c;
  a -> c;
}

这种情况经常发生,而且很烦人(这里也一样,但是带有边缘):

This happens quite often and it's annoying (same here, but with edges):

我知道这是由于xlabel放在所有东西都摆好之后而造成的,但是我想知道是否有可能对它有所帮助-即说出需要放置标签的地方.

I understand that this is caused by the fact that xlabels are put after all the things were laid out, but I was wondering if it's possible to help it a bit - i.e. say it where the label needs to be placed.

推荐答案

您无法执行此操作-您想提供xlabel的位置信息,但是graphviz当前(2016-01-25)不允许这样做. graphviz错误跟踪器中有一个打开功能请求为了这个能力;它描述为:

You can't do this -- you want to provide position information for the xlabel, but graphviz does not currently (2016-01-25) allow this. There is an open feature request in the graphviz bug tracker for this ability; it is described as:

这基本上是一个功能请求,用于允许用户提供xlabel的位置信息.对于附加到节点的xlabel,坐标应相对于节点位置.类似的功能可能适用于边缘的头和尾标签.我想边缘的xlabel可以基于边缘的中心".

this is basically a feature request for allowing the user to provide position information for xlabels. For xlabels attached to nodes, the coordinates should be relative to the node position. A similar feature could hold for head and tail labels for edges. I suppose xlabels for edges could be based on the "center" of the edge.

这篇关于节点的xlabel与点的边缘重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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