How to have arrow 2 have the same shape as arrow 1?
digraph {
rankdir=LR
label = "Lý thuyết ý định hành động";
labelloc = t
labeljust = r
fontsize = 20
fontname = Lato
overlap=false;
a [ label = "Thái độ của\nbản thân đối\nvới hành động" ]
b [ label = "Cảm nhận về\nthế nào là\nchuẩn mực" group=g1]
c [ label = "Cảm nhận về\nkhả năng đạt\nđược kết quả" ]
d [ label = "Có ý định hành động" group=g1 style=rounded shape=polygon ]
e [ label = "Thực sự hành động" group=g1 style=rounded shape=box3d ]
{ rank=same; a, b, c }
a:w -> b:w [ label="" dir=both]
a:w -> c:w [ label=" " dir=both]
b:w -> c:w [ label="" dir=both]
a:e -> d:n [ label="1" ]
b:e -> d:w
c:e -> d:s [ label="2" ]
d -> e
c -> e:s [style=dashed dir=none]
}
By the way, the left arrows can only be that symmetric when I put empty labels to them. Is there any explanation for this?
Related
I made a graph and it looks like I want it to with one exception: the cluster containing nodes D and E should be placed between nodes B and C.
Here is the .dot:
digraph {
node[shape=rectangle]
graph [
newrank=true
];
Z
A
B
C
{
rank=same;
A -> B -> D;
D -> C[style=invis];
}
subgraph clusterSS {
style=dashed;
D[group=ss]
E[group=ss]
D -> E[style="dashed"; dir = none];
}
Z -> A
Z -> B
Z -> D
Z -> C
A -> P[dir = back]
B -> S
S -> B[constraint = false];
C -> S
S -> E[constraint = false]
E -> S[label = "Label"]
}
I expected that having edges between nodes
{
rank=same;
A -> B -> D;
D -> C[style=invis];
}
would ensure correct ordering, but it doesn't.
The ordering becomes correct once I delete the edge label between S and E, but I do need to keep the labels.
[non-trivial, not guaranteed to work as desired in any other circumstance]
Added clusters, invisible nodes,and more. ugh
digraph {
node[shape=rectangle]
graph [
newrank=true
];
{
rank=same;
A -> B -> D;
D -> C[style=invis];
}
subgraph clusterSS {
style=dashed;
D [group=ss]
E [group=ss]
D -> E[style="dashed"; dir = none];
}
subgraph clusterAP {
peripheries=0
A -> P[dir = back]
}
subgraph clusterB {
peripheries=0
B
bogus [style=invis shape=plain]
B->bogus [style=invis]
}
Z -> A
Z -> B
Z -> D
Z -> C
S [group=ss]
B -> S:nw
B -> S:w [dir=back]
C -> S
S -> E[constraint = false]
E -> S[label = "Label"]
}
Giving:
How can I do the drawing of arrow
A1:Port1 -> A1:Port2 [dir=both]
nicer
So at least same connection point at the same point as the other connector. See picture.
Line between connectors of the same node
Round line between connecoors of the same node
digraph G {
graph [rankdir = LR];
node[shape=record];
A1[label="{A1|{<Port1>Port 1|<Port2>Port 2 }}"];
A2[label="{{<Port1>Port 1|<Port2>Port 2 }|A2}"];
A1:Port1 -> A1:Port2 [dir=both]
A1:Port1 -> A2:Port1 [dir=both]
}
I would introduce an intermediate node:
digraph G {
graph [rankdir = LR];
node[shape=record];
A1[label="{A1|{<Port1>Port 1|<Port2>Port 2 }}"];
A2[label="{{<Port1>Port 1|<Port2>Port 2 }|A2}"];
C[shape=point];
A1:Port1 -> C;
C -> A1:Port2;
C -> A2:Port1;
}
so you get:
Posting it as an answer, so that the resulting graph is clear:
digraph G
{
graph[ rankdir = LR, splines=line] ;
node[ shape=record ];
A1[ label= "{A1|{<Port1>Port 1|<Port2>Port 2 }}" ];
A2[ label= "{{<Port1>Port 1|<Port2>Port 2 }|A2}" ];
A1:Port1:e -> A1:Port2:e [ dir=both ]
A1:Port1 -> A2:Port1 [ dir=both, minlen = 2 ]
}
producing
This is what I want to produce in a DOT graph:
I have the following code:
\digraph
[scale=0.7]{g1}
{
margin="0 0 0 0";
rankdir="TB";
"X" [shape=invhouse];
" " [shape=house];
"100" [shape=cylinder];
"X" -> "100"
"X" -> "+";
"100" -> "+"
"+" -> " ";
}
I also have the following code, which is closer in a sense but visually looks nothing like what I want:
digraph {
node[ shape = plaintext ];
a [label="X", shape = invhouse]
b [label="+", shape = ellipse]
ab1 [label="dummy", style=invis, shape=point]
ab2 [label="dummy", style=invis, shape=point]
c [label="100", shape = cylinder]
d [label=" ", shape=house]
subgraph cluster_0 {
style=invis
a -> ab1 [arrowhead=none];
ab1 -> c;
c -> ab2;
ab1 -> ab2 [arrowhead=none];
ab2 -> b;
b -> d;
}
}
How can I change my code(s) appropriately? Any help would be greatly appreciated.
the group attribute helps to bring nodes in line.
digraph {
node[ shape = plaintext group=abd];
a [label="X", shape = invhouse]
b [label="+", shape = ellipse]
ab1 [label="dummy", style=invis, shape=point]
ab2 [label="dummy", style=invis, shape=point]
c [label="100", shape = cylinder, group=c]
d [label=" ", shape=house]
subgraph cluster_0 {
style=invis
a -> ab1 [arrowhead=none];
ab1 -> c;
c -> ab2;
ab1 -> ab2 [arrowhead=none];
ab2 -> b;
b -> d;
}
}
My structure has two main chains with side nodes in sub graphs. Every thing looks nice but when i close the two chains all the boxes in the sub graphs jumps to the right side.
At the end of my code you can remove the "I"->"J" then you can see the best what I mean.
I am not a native English speaker, sorry about my English and I am a graphviz newbie.
digraph G {
size ="6,6";
node [color=black fontsize=12, shape=box, fontname=Helvetica];
subgraph {
rank = same;
"b"->"B"[arrowhead=none];
}
subgraph {
rank=same;
"c"->"C"[arrowhead=none];
}
subgraph {
rank=same;
"e"->"E" [arrowhead=none];
}
subgraph {
rank = same;
"f"->"F"[arrowhead=none];
}
subgraph {
rank = same;
"g"->"G"[arrowhead=none];
}
"0" -> "A" -> "B" -> "C"->"D" -> "E" -> "F" -> "G" -> "H"->"I";
"0" -> "K"->"L"->"M"->"N"->"O" ->"P"->"1";
subgraph {
rank = same;
"L"->"l"[arrowhead=none];
}
subgraph {
rank=same;
"M"->"m"[arrowhead=none];
}
subgraph {
rank=same;
"N"->"n" [arrowhead=none];
}
subgraph {
rank = same;
"O"->"o"[arrowhead=none];
}
subgraph {
rank = same;
"P"->"p"[arrowhead=none];
}
"1"->"J";
"I"->"J";
}
and with "I"->"J"; removed:
This is how I'd go about it: Create a cluster for each main chain with its side nodes:
digraph G {
size ="6,6";
node [color=black fontsize=12, shape=box, fontname=Helvetica];
subgraph[style=invis];
subgraph cluster0 {
A -> B -> C -> D -> E -> F -> G -> H -> I;
edge[arrowhead=none];
{rank = same; b->B;}
{rank = same; c->C;}
{rank = same; e->E;}
{rank = same; f->F;}
{rank = same; g->G;}
}
subgraph cluster1 {
K -> L -> M -> N -> O -> P -> 1 -> J;
edge[arrowhead=none];
{rank = same; L->l;}
{rank = same; M->m;}
{rank = same; N->n;}
{rank = same; O->o;}
{rank = same; P->p;}
}
0 -> A;
0 -> K;
I -> J;
}
Resulting in:
This is what the generated graph looks currently:
And here is the code for this:
digraph {
rankdir=TB;
subgraph cluster01 {
label="1.fázis"
aSTART;
node [shape = doublecircle]; a001;
node [shape = ellipse];
aSTART -> a0 [ penwidth = 3 label = "0" ];
a0 -> a00 [ penwidth = 3 label = "0" ];
a00 -> a001 [ penwidth = 3 label = "1" ];
a0 -> aSTART [ label = "1" ];
a00 -> a00 [ label = "0" ];
a001 -> a0 [ label = "0"];
a001 -> aSTART [ label = "1"];
aSTART -> aSTART [ label = "1"];
}
subgraph cluster02
{
label="2.fázis"
bSTART; b1; b11;
node [shape = doublecircle]; b111;
node [shape = ellipse];
bSTART -> b1 [ penwidth = 3 label = "1" ];
b1 -> b11 [ penwidth = 3 label = "1" ];
b11 -> b111 [ penwidth = 3 label = "1" ];
b1 -> bSTART [ label = "0" ];
b11 -> bSTART [ label = "0" ];
b111 -> bSTART [ label = "0"];
bSTART -> bSTART [ label = "0"];
b111 -> b111 [label = "1"];
}
subgraph cluster03
{
label="3.fázis";
cSTART; c0; c1; c01; c10;
node [shape = doublecircle]; c010; c100;
node [shape = ellipse];
cSTART -> c0 [ penwidth = 3 label = "0" ];
c0 -> c01 [ label = "1" ];
c01 -> c010 [ penwidth = 3 label = "0" ];
cSTART -> c1 [ label = "1" ];
c1 -> c10 [ penwidth = 3 label = "0" ];
c10 -> c100 [ label = "0" ];
c0 -> c1 [ penwidth = 3 label = "1" ];
c01 -> c1 [ label = "1" ];
c1 -> c1 [label = "1"];
c10 -> c01 [ penwidth = 3 label = "1"];
c010 -> c100 [penwidth = 3 label = "0"];
c010 -> c01 [label = "1"];
c100 -> c01 [label = "1"];
c100 -> c0 [label = "0"];
}
a001 -> b1 [color = "red" style = "dashed"];
b111 -> c1 [color = "red" style = "dashed"];
}
If I remove the 2 red lines, then it lines up the way I want it to:
How could I make it line up like this and have the two red lines at the same time?
You can add
{
rank=same;
aSTART;
bSTART
cSTART;
}
After your subgraph cluster03. Dot will yield you a warning but draw the way yo want:
D:\Code\funfunfun>dot -Tpng -oso1.png -Gcharset=latin1 so1.dot
Warning: aSTART was already in a rankset, ignored in cluster _anonymous_0
Warning: bSTART was already in a rankset, ignored in cluster _anonymous_0
Warning: cSTART was already in a rankset, ignored in cluster _anonymous_0
Patched graph available here
You should use the constraint=false attribute on the two red edges.
If false, the edge is not used in ranking the nodes.