is an option for Tree and related functions that specifies what labels should be used for subtree elements.


  • 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:
  • Noneuse no label
    Automaticuse the subtree data as the 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.
  • In TreeElementLabel, Alllbl uses lbl for all subtrees.


open allclose all

Basic Examples  (4)

Label an individual subtree element:

Label all subtree elements:

Use no labels:

Specify positions using patterns:

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 (13), TreeElementLabel, Wolfram Language function,


Wolfram Research (13), TreeElementLabel, Wolfram Language function,


Wolfram Language. 13. "TreeElementLabel." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (13). TreeElementLabel. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2021_treeelementlabel, author="Wolfram Research", title="{TreeElementLabel}", year="13", howpublished="\url{}", note=[Accessed: 24-January-2022 ]}


@online{reference.wolfram_2021_treeelementlabel, organization={Wolfram Research}, title={TreeElementLabel}, year={13}, url={}, note=[Accessed: 24-January-2022 ]}