[O] How to place things differently in dot
I was asked to make a diagram and was thinking that dot in org-mode could be a good idea. I got reasonably fast the following: #+BEGIN_SRC dot :file test.svg :cmdline -Kdot -Tsvg graph { utilities [label = "Utility's"] A B C D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = "Resources"] } G H I K subgraph cluster_ta { color=blue {rank = same; L, M} L M } {rank = same; D, E, F} A -- F B -- F C -- F A -- D F -- E F -- K F -- G F -- H F -- I K -- L K -- M L -- M } #+END_SRC This is a good deal in the right direction, but a few things should be different: - E should be left of F - resource should go to the second 'line' without losing its border - K should be a 'line' lower Are those things possible? As attachment how it looks now. -- Cecil Westerhof
Re: [O] How to place things differently in dot
On Thursday, 26 Mar 2015 at 13:14, Cecil Westerhof wrote: > I was asked to make a diagram and was thinking that dot in org-mode could > be a good idea. [...] > This is a good deal in the right direction, but a few things should be > different: The graphviz tools are fantastic for quick and dirty graphs but the layout algorithms are not easily controlled... I would highly recommend tikz ... If you do want to use dot, I have only ever managed to get what I want by changing the order in which I specify the connections and/or more use of sub-graphs. -- : Eric S Fraga (0xFFFCF67D), Emacs 24.4.1, Org release_8.3beta-790-gb719c1.dirty
Re: [O] How to place things differently in dot
On 2015-03-26 at 11:52, e.fr...@ucl.ac.uk wrote: > The graphviz tools are fantastic for quick and dirty graphs but the > layout algorithms are not easily controlled... I would highly > recommend tikz ... Or perhaps ditaa. -k.
Re: [O] How to place things differently in dot
2015-03-26 17:07 GMT+01:00 Ken Mankoff : > > On 2015-03-26 at 11:52, e.fr...@ucl.ac.uk wrote: > > The graphviz tools are fantastic for quick and dirty graphs but the > > layout algorithms are not easily controlled... I would highly > > recommend tikz ... > > Or perhaps ditaa. > It is certainly quick. I wait if they find it acceptable: if not I can always check-out tikz or ditaa. -- Cecil Westerhof
Re: [O] How to place things differently in dot
Cecil Westerhof writes: > I was asked to make a diagram and was thinking that dot in org-mode could > be a good idea. > > I got reasonably fast the following: > #+BEGIN_SRC dot :file test.svg :cmdline -Kdot -Tsvg > graph { > utilities [label = "Utility's"] > > A > B > C > > D > E > F [shape = rectangle] > > > subgraph cluster_resources { > color=blue > resources [label = "Resources"] > } > > G > H > I > > K > subgraph cluster_ta { > color=blue > {rank = same; L, M} > L > M > } > > {rank = same; D, E, F} > > > A -- F > B -- F > C -- F > A -- D > > F -- E > > F -- K > F -- G > F -- H > F -- I > > > K -- L > K -- M > L -- M > } > #+END_SRC > > This is a good deal in the right direction, but a few things should be > different: > - E should be left of F > - resource should go to the second 'line' without losing its border > - K should be a 'line' lower > > Are those things possible? As a last resort, you can edit the svg file. hth, Tom -- Thomas S. Dye http://www.tsdye.com
Re: [O] How to place things differently in dot
2015-03-26 18:00 GMT+01:00 Thomas S. Dye : > Cecil Westerhof writes: > > > I was asked to make a diagram and was thinking that dot in org-mode could > > be a good idea. > > > > I got reasonably fast the following: > > #+BEGIN_SRC dot :file test.svg :cmdline -Kdot -Tsvg > > graph { > > utilities [label = "Utility's"] > > > > A > > B > > C > > > > D > > E > > F [shape = rectangle] > > > > > > subgraph cluster_resources { > > color=blue > > resources [label = "Resources"] > > } > > > > G > > H > > I > > > > K > > subgraph cluster_ta { > > color=blue > > {rank = same; L, M} > > L > > M > > } > > > > {rank = same; D, E, F} > > > > > > A -- F > > B -- F > > C -- F > > A -- D > > > > F -- E > > > > F -- K > > F -- G > > F -- H > > F -- I > > > > > > K -- L > > K -- M > > L -- M > > } > > #+END_SRC > > > > This is a good deal in the right direction, but a few things should be > > different: > > - E should be left of F > > - resource should go to the second 'line' without losing its border > > - K should be a 'line' lower > > > > Are those things possible? > > As a last resort, you can edit the svg file. > It did cross my mind, but I am afraid it is not a real option (for me). -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-26 17:57 GMT+01:00 Cecil Westerhof : > 2015-03-26 17:07 GMT+01:00 Ken Mankoff : > >> >> On 2015-03-26 at 11:52, e.fr...@ucl.ac.uk wrote: >> > The graphviz tools are fantastic for quick and dirty graphs but the >> > layout algorithms are not easily controlled... I would highly >> > recommend tikz ... >> >> Or perhaps ditaa. >> > > It is certainly quick. I wait if they find it acceptable: if not I can > always check-out tikz or ditaa. > I looked at ditaa and tikz. Especially ditta is very nice. It has document and database elements, but it would also a lot more work to create and especially to maintain. So I hope my dot version is acceptable. -- Cecil Westerhof
Re: [O] How to place things differently in dot
Cecil Westerhof writes: > I was asked to make a diagram and was thinking that dot in org-mode could be > a good idea. > > I got reasonably fast the following: > This is a good deal in the right direction, but a few things should be > different: > - E should be left of F > - resource should go to the second 'line' without losing its border > - K should be a 'line' lower > Maybe this will help although it's not a complete implementation of what you have. The idea is to define rows and arrange your nodes into those rows by using rank=same. Then make the row nodes and edges invisible. It's also important to do the sequencing correctly, e.g. in your example, if you just switch F -- E to E -- F, E will be to the left of F as you want. But I don't know how to get the resources subgraph to be treated as a node and thereby place it on the same row as F. In any case, here's the current trial balloon: --8<---cut here---start->8--- #+BEGIN_SRC dot :file test2.svg :cmdline -Kdot -Tsvg graph foo { row1--row2--row3--row4 [style="invisible"]; row1, row2, row3, row4 [style="invisible"]; utilities [label = "Utilities"] A B C D E F [shape="rectangle"] G H I K subgraph cluster_ta { color=blue {rank = same; L, M;} L M } {rank=same; row1 utilities A B C; } {rank=same; row2 D E F;} {rank=same; row3 G H I;} {rank=same; row4 K;} subgraph cluster_resources { resources [label = "Resources"] graph[color=red]; } A -- F B -- F C -- F A -- D E -- F F -- G F -- H F -- I F -- K K -- L K -- M L -- M } #+END_SRC --8<---cut here---end--->8--- HTH, Nick
Re: [O] How to place things differently in dot
2015-03-26 21:27 GMT+01:00 Nick Dokos : > Cecil Westerhof writes: > > > I was asked to make a diagram and was thinking that dot in org-mode > could be a good idea. > > > > I got reasonably fast the following: > > > This is a good deal in the right direction, but a few things should be > different: > > - E should be left of F > > - resource should go to the second 'line' without losing its border > > - K should be a 'line' lower > > > > Maybe this will help although it's not a complete implementation of > what you have. The idea is to define rows and arrange your nodes into > those rows by using rank=same. Then make the row nodes and edges > invisible. It's also important to do the sequencing correctly, e.g. > in your example, if you just switch F -- E to E -- F, E will be to the > left of F as you want. But I don't know how to get the resources > subgraph to be treated as a node and thereby place it on the same row as F. > > In any case, here's the current trial balloon: > > --8<---cut here---start->8--- > #+BEGIN_SRC dot :file test2.svg :cmdline -Kdot -Tsvg > graph foo { > row1--row2--row3--row4 [style="invisible"]; > row1, row2, row3, row4 [style="invisible"]; > > utilities [label = "Utilities"] > A > B > C > D > E > F [shape="rectangle"] > G > H > I > K > subgraph cluster_ta { > color=blue > {rank = same; L, M;} > L > M > } > > {rank=same; row1 utilities A B C; } > {rank=same; row2 D E F;} > {rank=same; row3 G H I;} > {rank=same; row4 K;} > > subgraph cluster_resources { > resources [label = "Resources"] > graph[color=red]; > } > > A -- F > B -- F > C -- F > A -- D > E -- F > F -- G > F -- H > F -- I > F -- K > K -- L > K -- M > L -- M > } > #+END_SRC > > --8<---cut here---end--->8--- > I did it a little differently: #+BEGIN_SRC dot :file test.png :cmdline -Kdot -Tpng graph { utilities [label = "Utility's"] A B C D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = "Resources"] } G G_ [style="invisible"] H I K subgraph cluster_ta { color=blue {rank = same; L, M} L M } {rank = same; D, E, F} {rank = same; G_, K} A -- F B -- F C -- F A -- D E -- F F -- K F -- G F -- H F -- I G -- G_ [style="invisible"] K -- L K -- M L -- M } #+END_SRC In this way I do not get an empty column. It would be better when K would put between and below H and I, but I think I can live with it. -- Cecil Westerhof
Re: [O] How to place things differently in dot
Cecil Westerhof writes: > In this way I do not get an empty column. It would be better when K > would put between and below H and I, but I think I can live with it. > Just put I after K and the subgraph. Nick
Re: [O] How to place things differently in dot
Cecil Westerhof writes: > > In this way I do not get an empty column. You can make the rows be of size 0: --8<---cut here---start->8--- #+BEGIN_SRC dot :file test2.svg :cmdline -Kdot -Tsvg graph foo { row1--row2--row3--row4 [style="invis", fixedsize="true", width="0", height="0"]; row1, row2, row3, row4 [style="invis", fixedsize="true", width="0", height="0"]; ... --8<---cut here---end--->8--- Nick
Re: [O] How to place things differently in dot
2015-03-26 22:49 GMT+01:00 Nick Dokos : > Cecil Westerhof writes: > > > In this way I do not get an empty column. It would be better when K > > would put between and below H and I, but I think I can live with it. > > > > Just put I after K and the subgraph. > That works. It is even better when I put both H and I after it. I also found a way to get resources at the correct place. It know becomes: #+BEGIN_SRC dot :file test.png :cmdline -Kdot -Tpng graph { A B C utilities [label = "Utility's"] D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = "Resources"] } G G_ [style="invisible"] K subgraph cluster_ta { color=blue {rank = same; L, M} L M } H I {rank = same; D, E, F} {rank = same; G_, K} A -- F B -- F C -- F A -- D utilities -- resources [style="invisible"] E -- F F -- K F -- G F -- H F -- I G -- G_ [style="invisible"] K -- L K -- M L -- M } #+END_SRC That looks very good indeed: I think I do not need to start working with ditaa. :-) Everyone thanks for the help. -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-26 23:19 GMT+01:00 Cecil Westerhof : > 2015-03-26 22:49 GMT+01:00 Nick Dokos : > >> Cecil Westerhof writes: >> >> > In this way I do not get an empty column. It would be better when K >> > would put between and below H and I, but I think I can live with it. >> > >> >> Just put I after K and the subgraph. >> > > That works. It is even better when I put both H and I after it. > > I also found a way to get resources at the correct place. > I changed to a digraph: #+BEGIN_SRC dot :file test.png :cmdline -Kdot -Tpng digraph { A B C utilities [label = "Utility's"] D E F [shape = rectangle] subgraph cluster_resources { color=blue resources [label = "Resources"] } G G_ [style="invisible"] K subgraph cluster_ta { color=blue {rank = same; L, M} L M } H I {rank = same; D, E, F} {rank = same; G_, K} A -> F B -> F C -> F A -> D utilities -> resources [style="invisible"] E -> F F -> K [dir = back] F -> G [dir = back] F -> H [dir = back] F -> I [dir = back] G -> G_ [style="invisible"] K -> L K -> M L -> M } #+END_SRC There is only one problem: I see the arrowhead with: utilities -> resources and: 'G -> G_' Is there a way to get rid of those? -- Cecil Westerhof
Re: [O] How to place things differently in dot
2015-03-27 7:57 GMT+01:00 Cecil Westerhof : > 2015-03-26 23:19 GMT+01:00 Cecil Westerhof : > >> 2015-03-26 22:49 GMT+01:00 Nick Dokos : >> >>> Cecil Westerhof writes: >>> >>> > In this way I do not get an empty column. It would be better when K >>> > would put between and below H and I, but I think I can live with it. >>> > >>> >>> Just put I after K and the subgraph. >>> >> >> That works. It is even better when I put both H and I after it. >> >> I also found a way to get resources at the correct place. >> > > I changed to a digraph: > #+BEGIN_SRC dot :file test.png :cmdline -Kdot -Tpng > digraph { > A > B > C > utilities [label = "Utility's"] > > D > E > F [shape = rectangle] > > > subgraph cluster_resources { > color=blue > resources [label = "Resources"] > } > > G > G_ [style="invisible"] > > K > subgraph cluster_ta { > color=blue > {rank = same; L, M} > L > M > } > H > I > > {rank = same; D, E, F} > {rank = same; G_, K} > > > A -> F > B -> F > C -> F > A -> D > utilities -> resources [style="invisible"] > > E -> F > > F -> K [dir = back] > F -> G [dir = back] > F -> H [dir = back] > F -> I [dir = back] > > G -> G_ [style="invisible"] > > K -> L > K -> M > L -> M > } > #+END_SRC > > There is only one problem: I see the arrowhead with: > utilities -> resources > and: > 'G -> G_' > > Is there a way to get rid of those? > I found that also: [style="invisible", arrowhead = "none"] -- Cecil Westerhof