TreeElementLabel

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:
  • Automaticuse the subtree data as the label
    Noneuse no label
    lbllabel the subtree element with lbl
    {pos1lbl1,pos2lbl2,}label the subtree element at position posi with lbli
    {patt1lbl1,patt2lbl2,}label subtree elements 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, StatusAreashow as tooltip or in status area on mouseover
    Centerplace label at center of subtree element
    Before,After,Below,Aboveplace label outside before, after, etc.
    Left,Right,Bottom,Topplace 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, TreeElementLabelStyle and TreeElementLabelFunction, with later specifications overriding earlier ones.
  • In TreeElementLabel, Alllbl uses lbl for all subtrees.
  • In TreeElementLabel, TreeCases[pattern]lbl uses lbl for all subtrees with data matching pattern.

Examples

open allclose all

Basic Examples  (5)

Label an individual subtree element:

Label all subtree elements:

Use no labels:

Place labels above subtree elements:

Specify positions using position patterns:

Specify positions using data patterns:

Scope  (9)

Label Placement  (9)

Use Placed with symbolic locations to control label placement, including outside positions:

Symbolic outside corner positions:

Symbolic inside 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:

Use more elaborate formatting functions:

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:

Wolfram Research (2021), TreeElementLabel, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeElementLabel.html (updated 2022).

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

BibTeX

@misc{reference.wolfram_2024_treeelementlabel, author="Wolfram Research", title="{TreeElementLabel}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/TreeElementLabel.html}", note=[Accessed: 23-April-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_treeelementlabel, organization={Wolfram Research}, title={TreeElementLabel}, year={2022}, url={https://reference.wolfram.com/language/ref/TreeElementLabel.html}, note=[Accessed: 23-April-2024 ]}