python - Tips on generating Pete Frame-style Rock Family Tree in Graphviz -
i've written simple python program (my first!) takes 3 csv files - people, bands, links - , generates graphviz dot file shows "rock family tree", people show in different bands, , bands go through different lineups. i'm trying close pete frame's wonderful rock family trees (although they'll never good, or detailed).
the code generated far looks this:
digraph family_tree { graph [style="solid", ranksep="0.6", fontname="berthold akzidenz grotesk", fontsize=24, label="those post-rock", labelloc="tl", bgcolor="white", fontcolor="black", penwidth="1", color="black", margin=0, nodesep="0.1", splines="polyline"]; edge [fontname="berthold akzidenz grotesk", fontsize=10, arrowhead="none", penwidth="1", minlen="1" ]; node [style="solid", margin="0", fontname="berthold akzidenz grotesk", shape="none", fontsize=20, fillcolor="white" ]; # band members - unique per person/band combination "(various people) - eviva" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">(various people)</td></tr><tr><td border="0" valign="top"><font point-size="10">drums, vocals</font></td></tr></table>>] "(various people) - attic" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">(various people)</td></tr><tr><td border="0" valign="top"><font point-size="10">drums, vocals</font></td></tr></table>>] "abb - zirkus" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">abb</td></tr><tr><td border="0" valign="top"><font point-size="10">synths, machines, programming</font></td></tr></table>>] "adam clayton - flange circus #2" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">adam clayton</td></tr><tr><td border="0" valign="top"><font point-size="10">keyboard, violin</font></td></tr></table>>] "bon holloway - chameleon day" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">bon holloway</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar</font></td></tr></table>>] "bon holloway - flange circus #1" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">bon holloway</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar, keyboard, programming, vocals</font></td></tr></table>>] "bon holloway - flange circus #2" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">bon holloway</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar, keyboard, programming, vocals</font></td></tr></table>>] "bon holloway - nocturne" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">bon holloway</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar</font></td></tr></table>>] "bon holloway - rose garden sacrifice" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">bon holloway</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar</font></td></tr></table>>] "charles freedman - eviva" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">charles freedman</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar</font></td></tr></table>>] "chris gunningham - bobby valentino , jazz police" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">chris gunningham</td></tr><tr><td border="0" valign="top"><font point-size="10">bass</font></td></tr></table>>] "chris jones - bobby valentino , jazz police" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">chris jones</td></tr><tr><td border="0" valign="top"><font point-size="10">drums</font></td></tr></table>>] "craig mcintosh - wooly mammoth" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">craig mcintosh</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar</font></td></tr></table>>] "danny tompkins - bobby valentino , jazz police" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">danny tompkins</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar</font></td></tr></table>>] "darren hanson - chameleon day" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">darren hanson</td></tr><tr><td border="0" valign="top"><font point-size="10">bass</font></td></tr></table>>] "darren hanson - nocturne" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">darren hanson</td></tr><tr><td border="0" valign="top"><font point-size="10">bass</font></td></tr></table>>] "darren hanson - rose garden sacrifice" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">darren hanson</td></tr><tr><td border="0" valign="top"><font point-size="10">bass</font></td></tr></table>>] "dave colbourne - terminal sunshine" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">dave colbourne</td></tr><tr><td border="0" valign="top"><font point-size="10">drums</font></td></tr></table>>] "glenn ??? - attic" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">glenn ???</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar, vocals</font></td></tr></table>>] "glenn ??? - yahoo's" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">glenn ???</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar, vocals</font></td></tr></table>>] "jamie wire - eviva" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">jamie wire</td></tr><tr><td border="0" valign="top"><font point-size="10">bass, guitar</font></td></tr></table>>] "jay stillwell - chameleon day" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">jay stillwell</td></tr><tr><td border="0" valign="top"><font point-size="10">drums</font></td></tr></table>>] "jay stillwell - nocturne" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">jay stillwell</td></tr><tr><td border="0" valign="top"><font point-size="10">drums</font></td></tr></table>>] "jay stillwell - rose garden sacrifice" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">jay stillwell</td></tr><tr><td border="0" valign="top"><font point-size="10">drums</font></td></tr></table>>] "john taylor - flange circus #1" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">john taylor</td></tr><tr><td border="0" valign="top"><font point-size="10">organ</font></td></tr></table>>] "john taylor - flange circus #2" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">john taylor</td></tr><tr><td border="0" valign="top"><font point-size="10">organ</font></td></tr></table>>] "josh saunders - nocturne" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">josh saunders</td></tr><tr><td border="0" valign="top"><font point-size="10">vocals</font></td></tr></table>>] "josh saunders - rose garden sacrifice" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">josh saunders</td></tr><tr><td border="0" valign="top"><font point-size="10">vocals</font></td></tr></table>>] "martin smith - a4 notice" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">martin smith</td></tr><tr><td border="0" valign="top"><font point-size="10">synths, programming</font></td></tr></table>>] "matthew eades - wooly mammoth" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">matthew eades</td></tr><tr><td border="0" valign="top"><font point-size="10">bass, guitar, vocals</font></td></tr></table>>] "matthew petty - probe" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">matthew petty</td></tr><tr><td border="0" valign="top"><font point-size="10">machines</font></td></tr></table>>] "nick topp - plunge" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">nick topp</td></tr><tr><td border="0" valign="top"><font point-size="10">drums</font></td></tr></table>>] "paul morgan - plunge" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">paul morgan</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar</font></td></tr></table>>] "paul stevenson - terminal sunshine" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">paul stevenson</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar, vocals</font></td></tr></table>>] "pete collins - a4 notice" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">pete collins</td></tr><tr><td border="0" valign="top"><font point-size="10">synths, bass, programming</font></td></tr></table>>] "pete collins - eviva" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">pete collins</td></tr><tr><td border="0" valign="top"><font point-size="10">keyboards, programming</font></td></tr></table>>] "pete collins - flange circus #1" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">pete collins</td></tr><tr><td border="0" valign="top"><font point-size="10">bass, keyboard, programming</font></td></tr></table>>] "pete collins - flange circus #2" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">pete collins</td></tr><tr><td border="0" valign="top"><font point-size="10">bass, keyboard, programming</font></td></tr></table>>] "pete collins - hawaii worms" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">pete collins</td></tr><tr><td border="0" valign="top"><font point-size="10">synths, programming, bass, vocals</font></td></tr></table>>] "pete collins - plunge" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">pete collins</td></tr><tr><td border="0" valign="top"><font point-size="10">bass, vocals</font></td></tr></table>>] "pete collins - terminal sunshine" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">pete collins</td></tr><tr><td border="0" valign="top"><font point-size="10">bass, vocals</font></td></tr></table>>] "pete collins - wooly mammoth" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">pete collins</td></tr><tr><td border="0" valign="top"><font point-size="10">keyboards, programming, vocals</font></td></tr></table>>] "pierre - zirkus" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">pierre</td></tr><tr><td border="0" valign="top"><font point-size="10">synths, machines, bass</font></td></tr></table>>] "robin deacon - bobby valentino , jazz police" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">robin deacon</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar, vocals</font></td></tr></table>>] "robin deacon - yahoo's" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">robin deacon</td></tr><tr><td border="0" valign="top"><font point-size="10">bass, vocals</font></td></tr></table>>] "simon moran - terminal sunshine" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">simon moran</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar, keyboard</font></td></tr></table>>] "stuart hearn - attic" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">stuart hearn</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar</font></td></tr></table>>] "tim morris - chameleon day" [margin=0, label=<<table border="0" cellspacing="0"><tr><td border="0">tim morris</td></tr><tr><td border="0" valign="top"><font point-size="10">guitar, vocals</font></td></tr></table>>] # bands "rose garden sacrifice" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">rose garden sacrifice</td><td border="0"><font point-size="10">(87)<br/>goff rock</font></td></tr></table>>] "the yahoo's" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">the yahoo's</td><td border="0"><font point-size="10">one rehearsal</font></td></tr></table>>] "nocturne" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">nocturne</td><td border="0"><font point-size="10">(88 - 89)<br/>goff rock</font></td></tr></table>>] "chameleon day" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">chameleon day</td><td border="0"><font point-size="10">(89 - 90)<br/>one gig, melded baggy<br/>with loop-esque psych</font></td></tr></table>>] "terminal sunshine" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">terminal sunshine</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "eviva" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">eviva</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "a4 notice" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">a4 notice</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "plunge" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">plunge</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "flange circus #1" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">flange circus #1</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "flange circus #2" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">flange circus #2</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "probe" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">probe</td><td border="0"><font point-size="10">(1991 - now)<br/>ongoing intent to<br/>make electronic music</font></td></tr></table>>] "wooly mammoth" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">wooly mammoth</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "hawaii worms" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">hawaii worms</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "flange circus #1" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">flange circus #1</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "flange circus #2" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">flange circus #2</td><td border="0"><font point-size="10"> </font></td></tr></table>>] "bobby valentino , jazz police" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">bobby valentino , jazz police</td><td border="0"><font point-size="10">cardiff art school combo<br/>doing nick cave covers</font></td></tr></table>>] "the attic" [bgcolor="yellow", margin=0, label=<<table sides="b" port="bandport" border="1" cellspacing="0"><tr><td border="0">the attic</td><td border="0"><font point-size="10">allegedly seminal<br/>bedford group</font></td></tr></table>>] # regular band links "eviva" -> "(various people) - eviva""the attic" -> "(various people) - attic""zirkus" -> "abb - zirkus""flange circus #2" -> "adam clayton - flange circus #2""chameleon day" -> "bon holloway - chameleon day""flange circus #1" -> "bon holloway - flange circus #1""flange circus #2" -> "bon holloway - flange circus #2""nocturne" -> "bon holloway - nocturne""rose garden sacrifice" -> "bon holloway - rose garden sacrifice""eviva" -> "charles freedman - eviva""bobby valentino , jazz police" -> "chris gunningham - bobby valentino , jazz police""bobby valentino , jazz police" -> "chris jones - bobby valentino , jazz police""wooly mammoth" -> "craig mcintosh - wooly mammoth""bobby valentino , jazz police" -> "danny tompkins - bobby valentino , jazz police""chameleon day" -> "darren hanson - chameleon day""nocturne" -> "darren hanson - nocturne""rose garden sacrifice" -> "darren hanson - rose garden sacrifice""terminal sunshine" -> "dave colbourne - terminal sunshine""the attic" -> "glenn ??? - attic""the yahoo's" -> "glenn ??? - yahoo's""eviva" -> "jamie wire - eviva""chameleon day" -> "jay stillwell - chameleon day""nocturne" -> "jay stillwell - nocturne""rose garden sacrifice" -> "jay stillwell - rose garden sacrifice""flange circus #1" -> "john taylor - flange circus #1""flange circus #2" -> "john taylor - flange circus #2""nocturne" -> "josh saunders - nocturne""rose garden sacrifice" -> "josh saunders - rose garden sacrifice""a4 notice" -> "martin smith - a4 notice""wooly mammoth" -> "matthew eades - wooly mammoth""probe" -> "matthew petty - probe""plunge" -> "nick topp - plunge""plunge" -> "paul morgan - plunge""terminal sunshine" -> "paul stevenson - terminal sunshine""a4 notice" -> "pete collins - a4 notice""eviva" -> "pete collins - eviva""flange circus #1" -> "pete collins - flange circus #1""flange circus #2" -> "pete collins - flange circus #2""hawaii worms" -> "pete collins - hawaii worms""plunge" -> "pete collins - plunge""terminal sunshine" -> "pete collins - terminal sunshine""wooly mammoth" -> "pete collins - wooly mammoth""zirkus" -> "pierre - zirkus""bobby valentino , jazz police" -> "robin deacon - bobby valentino , jazz police""the yahoo's" -> "robin deacon - yahoo's""terminal sunshine" -> "simon moran - terminal sunshine""the attic" -> "stuart hearn - attic""chameleon day" -> "tim morris - chameleon day" # more links "rose garden sacrifice" -> "nocturne" [label="became"]"nocturne" -> "chameleon day" [label=" "]"pete collins - terminal sunshine" -> "a4 notice" [label="went on form"]"pete collins - terminal sunshine" -> "plunge" [label="went on form"]"a4 notice" -> "plunge" [label="parallel project"]"pete collins - plunge" -> "eviva" [label=" "]"pete collins - eviva" -> "wooly mammoth" [label=" "]"pete collins - wooly mammoth" -> "hawaii worms" [label="went on form"]"pete collins - hawaii worms" -> "flange circus #1" [label="went on form"]"flange circus #1" -> "flange circus #2" [label=" "]"pete collins - flange circus #2" -> "zirkus" [label="parallel project"]"bon holloway - flange circus #2" -> "zirkus" [label="parallel project"]"robin deacon - yahoo's" -> "bobby valentino , jazz police" [label=" "]"bon holloway - chameleon day" -> "flange circus #1" [label=" "] { rank=same; "a4 notice"; "plunge"; } }
- bands html label nodes, name + comment
- people html label nodes, name + instrument or comment
- a person in band unique record, because same person might different things in different bands.
questions:
- how can automatically assign ranks bands don't appear in same rank people? (e.g. nocturne)
- how can space nodes out horizontally?
- i prefer ortho splines, don't connect underside of band node.
- how make edges touch underside of band nodes?
- is there overall better way of doing this?
that's lot of questions 1 question. ;) answer #2, use nodesep
attribute @ graph level widen space between nodes. default value allows them quite close:
reference: graphviz documentation.
Comments
Post a Comment