Letters and numbers position

Hello,
sorry for my bad English, I speak french.

I have that

digraph finite_state_machine {
size="8,5"
node [shape = circle];
rotate=90;
B -> B [ label = "0.3" ];
B -> A [ label = "0.1" ];
B -> C [ label = "0.6" ];
A -> A [ label = "0.5" ];
A -> B [ label = "0.3" ];
A -> C [ label = "0.2" ];
C -> C [ label = "0.25" ];
C -> A [ label = "0.4" ];
C -> B [ label = "0.35" ];
}
I have the following error but I don't see why.:
Warning: :2: syntax error in line 2 near 'digraph'

But it works.

I want to have letters (A, B and C) and numbers (labels) with a correct position. Is it possible?

Regards

> I have the following error

> I have the following error but I don't see why.:
> Warning: :2: syntax error in line 2 near 'digraph'

I don't see why either; the graph is perfectly legal. How are you running Graphviz and on what type of machine?

>  I want to have letters (A, B and C) and numbers (labels) with a correct position. Is it possible?

What do you mean by "correct position"? What do you want the image to look like?

1) I have a PC with Windows 7

1) I have a PC with Windows 7 Ultimate 64 bits

2) See that

digraph finite_state_machine {
size="15,5"
node [shape = circle];
rotate=90;
N -> N [ label = "0.3" ];
N -> A [ label = "0.1" ];
N -> C [ label = "0.6" ];
A -> A [ label = "0.5" ];
A -> N [ label = "0.3" ];
A -> C [ label = "0.2" ];
C -> C [ label = "0.25" ];
C -> A [ label = "0.4" ];
C -> N [ label = "0.35" ];
}

The letters are N, A and C.

But  with wrong position N appears like Z.

How to do to have right (normal) positions for letters and numbers?

Regards

1. What version of graphviz

1. What version of graphviz are you using? And are you using gvedit or a command-line tool?

2. The specification rotate=90 tells the layout to draw the graph and then rotate it by 90 degrees. Remove that line and the letters will appear correctly.

I use Graphviz version 2.30.

  1. I use Graphviz version 2.30. I use Gvedit.
  2. OK for "rotate=90".

But how to do for having the nodes positioned

  • horizontally on the same line?

or

  • vertically on the same column?

The dot layout model assumes

The dot layout model assumes nodes are placed on district levels and if you have an edge A->B, A will be placed above B. There is no guaranteed notion of vertical alignment. In the output with no rotate command, N and C are vertically aligned because dot tries to make the edge N->C as short as possible.

Since nodes are placed on ranks, there is a notion of horizontal alignment: all nodes in a subgraph with the property rank=same will be placed on the same rank.

digraph G {

  {rank=same N A}

  N->A A->C N->C

}

will have N and A on the same horizontal line. You can encourage vertical alignment by increasing the weight of an edge, but as mentioned above, vertical alignment cannot be guaranteed.

Finally, if the graph has the attribute rankdir=LR, this flips the roles of horizontal and vertical. This may be what you wanted instead of rotate=90, which rotates the final drawing by 90 degrees.

OK for "rank". But is it

OK for "rank".

But is it possible to place the label in a chosen position in relation of node or edge?

For example

digraph G {

{rank=same V R}

V->V [ label = "0.85" ];

V->R [ label = "0.15" ];

R->V [ label = "0.3" ];

R->R [ label = "0.7" ];

}

With dot layout, I have as wanted horizontal alignment but I want to have "[ label = "0.85" ];" on the left of letter V for a good legibility.

Is it possible?

 

Try V:w->V:w [ label =

Try

V:w->V:w [ label = "0.85" ];

 

Fantastic, it works. Thank

Fantastic, it works.

Thank you for all.

Regards.

Recent comments