Number: 2037
Title: Labels overlap edges and nodes and can be unreadable
Submitter: Justin Dobbs
Date: Wed Sep 15 14:45:32 2010
Subsys: Dot
Version: 2.27
System: x86-Windows-XP
Severity: minor
Problem:
I'm trying to draw a state machine using dot. I was using Visio but would prefer not to waste time arranging nodes and drawing primitives.

Some of my labels are rather long, and get jumbled up either against shapes or over each other. The result is pretty hard to read.

It would be nice if:

1) There were a way to place labels right over edges, perhaps with a solid white background to clear the way for the text

2) The routing strategy incorporated the size of the label, so that the label isn't just pasted on over whatever happens to be there.

Sweet tool though!
Input file: b2037.gv
Output file: b2037.svg
Comments:
[arif] Edge labeling is not Graphviz' best strength. A work around could be defining those edge labels as nodes and set node border color to white.

[erg] Actually, dot does do 2). Each edge label is treated as a dummy node and allocated its own space, away from any node or other edge label. What you are seeing here is a real bug, in which one edge label is being assigned the same position as another.

The bug is related to the warning you should be seeing. At present, dot does not allow a node to be constrained twice by subgraphs. In your input, you place s5 in cluster W and also say that S5 and sX0 to have the same rank. You only get to choose one. If you comment out


  {
    rank = same;
    s5; sX0;
  }

the problem goes away. You still need to decide if you want sX0 in cluster X or not.

Concerning 1), we are working on providing a post-processing labeling feature. This will be helpful in certain cases, but as space isn't allocated, it may fail with very large labels. Also, if you use HTML-like labels for the edges, you can arrange to have the label text drawn on a white rectangle.
Owner: *
Status: *