Using dot/graphviz 2.47.0
Running ubuntu 20.04.2 LTS on oracle virtual box 6.1 hosted on windows 10.
Command line: dot -T jpg house-shape-width.gv > house-shape-width.jpg
Using dot; I have found that when I choose shape=house for a node the node is quite a bit wider than if I use rectangle. I have tried setting margin and it does not seem to help. At first I though it was because the first line of text was projecting into the triangle part of the house shape, but I no longer think that is the problem because the excess width is greater when there are two lines rather than just one line. Adding a top line with a single character line &-n-b-s-p-; (non-breaking space) does not seem to help.
Any advice ?
.jpg attached (but same result using .pdf)
strict digraph "house-shape-width"
{
TITLE [fontsize=16,
label=<House Shape Width<br/>10 Apr 2021>
shape=ellipse
peripheries=2]
newrank=true
edge [arrowhead=none]
node [shape=rect]
graph [ranksep=0.4]
"h1-line" [shape=house label=<the quick brown fox A>];
"h2-line" [shape=house label=<the quick brown fox A<br/>B>];
"ih1-line" [shape=invhouse label=<the quick brown fox A>];
"ih2-line" [shape=invhouse label=<the quick brown fox A<br/>B>];
"r1-line" [shape=rect label=<the quick brown fox A>];
"r2-line" [shape=rect label=<the quick brown fox A<br/>B>];
"h1-line" -> "r1-line"
"r1-line" -> "ih1-line"
"ih1-line" -> "r2-line"
"r2-line" -> "h2-line"
"h2-line" -> "ih2-line"
}
Yep, fat nodes. I looked quickly in shapes.c, but saw nothing.
I fooled around trying to find a work-around and eventually found that explicitly setting width & height of the node and setting fixedsize=true produced skinnier nodes.
For testing, I set height & width manually, but then I produced this (Linux) script to size the houses automatically:
using GVPR, change shapes from house/invhouse to rect, saving orig. shape as xshape
run that thru dot -Tdot to place nodes & edges
run that back thru GVPR to change node shapes back to orig. & add âfixedsize=trueâ
run that thru neato -Tpng -n to produce final output format without repositioning any nodes
There are so many new techniques and tools here, I will have to study it.
I had not heard of gvpr previously. I feel compelled to learn how to use it.
Thanks for this lesson.
@tmoog I think there are many tools to do this type of work. But thanks for sharing these techniques with us. Some other times i will check this. And then i will give you itâs feedback.
Thanks very much for the additional information. This is the kind of thing I was thinking about,
but did not have the details youâve specified clearly.
I've been distracted by another project the past week or so. I will try this when it is finished
in a couple of weeks.
I recognize the similarity of gvpr to awk. I used to use xml/xsl quite a bit, so pattern matching
and actions are not foreign.