Dendogram
Similarly to Tree, Dendogram is a renderable that can be used to visualize hierarchical data:
import Term.Dendograms: Dendogram
dendo = Dendogram("trunk", "the", "tree", "has", "leaves")
print(dendo) trunk
┌────────────┬──────┴─────┬────────────┐
the tree has leaves As you can see, the first argument is the "trunk" or title of the dendogram while all other arguments are added as leaves. Compare it to a Tree renderable:
import Term: Tree
print(
Tree(
Dict(:a=>"the", :b=>"tree", :c=>"has", :d=>"leaves")
)
)Dict(:a => "the", :b => "tree", :d => "leave
s", :c => "has")
├─ a ⇒ the
├─ b ⇒ tree
├─ d ⇒ leaves
└─ c ⇒ hasIf you've seen Tree, you'll know that Tree can handle nested hierarchical structures, what about Dendogram? The way you do that is by linking individual dendograms:
import Term.Dendograms: link
mydend = Dendogram("first", [1, 2])
otherdend = Dendogram("other", [:a, :b])
print(
link(mydend, link(otherdend, otherdend; title="another level"); title="One level")
) One level
┌─────────────────┴────────────────┐
first another level
┌──────┴─────┐ ┌───────────┴──────────┐
1 2 other other
┌──────┴─────┐ ┌──────┴─────┐
a b a b