TreeElementLabel
is an option for Tree and related functions that specifies what labels should be used for subtree elements.
Details
- TreeElementLabel allows specifying the label of the root node of a tree, as well as that of any subtrees at positions matching a pattern.
- The following option settings can be used:
-
Automatic use the node data as the label None use no label lbl label the root node with lbl Alllbl label all nodes with lbl TreeCases[pattern]lbl label the nodes with data matching pattern with lbl {pos1lbl1,pos2lbl2,…} label the node at position posi with lbli {patt1lbl1,patt2lbl2,…} label nodes at positions matching patti with lbli - Any expression can be used as a label.
- Placed[lbl,p] can be used to place labels in relative position to the subtree element box.
- The following placement specifications p can be used for Placed in positioning subtree element labels:
-
Tooltip, StatusArea show as tooltip or in status area on mouseover Center place label at center of subtree element Before,After,Below,Above place label outside before, after, etc. Left,Right,Bottom,Top place label inside to the left, right, etc. {Before,Below},{After,Below},… place label outside at corner before/below, etc. {Left,Bottom},{Right,Bottom},… place label inside at corner left/bottom, etc. {{vx,vy},{lx,ly}} scaled position {lx,ly} in the label at scaled position {vx,vy} in the vertex - Subtree element label specifications are effectively applied in the order TreeElementLabel, TreeElementLabelFunction and TreeElementLabelStyle, with later specifications overriding earlier ones.
Examples
open allclose allScope (11)
Label Placement (10)
Place labels above subtree elements:
Use Placed with symbolic locations to control label placement, including outside positions:
Symbolic outside corner positions:
Symbolic inside corner positions:
Use explicit coordinates to place the center of labels:
Place all labels at the upper-right corner of the subtree element and vary the coordinates within the label:
Placed multiple labels using Placed:
Any number of labels can be used:
Use the second argument to Placed to control formatting including Tooltip:
Or StatusArea:
Properties & Relations (5)
Subtree elements are automatically labeled with the data of that subtree:
Labels for subtree elements can be specified by position:
Labels specified by a subtree take precedence over labels specified by its ancestors:
A position {i,j,…} in a subtree refers to its subtree at relative position {i,j,…}:
A relative position {2} at position {1} refers to the global position {1,2}:
In general, a pattern patt applies to subtrees at global positions {i,j,…} that match patt:
A list of patterns {patt1,patt2,…} applies to relative positions {i,j,…} that match the patti:
Text
Wolfram Research (2021), TreeElementLabel, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeElementLabel.html (updated 2022).
CMS
Wolfram Language. 2021. "TreeElementLabel." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/TreeElementLabel.html.
APA
Wolfram Language. (2021). TreeElementLabel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TreeElementLabel.html