displays expr as a tree with different levels at different depths.
displays expr as a tree only down to level n.
Details and Options
- With a notebook front end, TreeForm displays as a graphical tree in StandardForm and TraditionalForm.
- TreeForm takes the same options as TreePlot.
- VertexLabeling->Automatic does not display expression fragments at each node, but still gives subtree expression as tooltips.
- VertexLabeling->False does not give expression fragments or tooltips.
- The typeset form of TreeForm[expr] is interpreted the same as expr when used in input. »
- When an input evaluates to TreeForm[expr], TreeForm does not appear in the output. »
Examplesopen allclose all
Basic Examples (3)
A formatted symbolic expression with mathematical constants:
A formatted expression with symbolic, exact and inexact values:
An expression containing subscripted variables:
A formatted expression with a special superscript and OverBar:
A Series expression:
An expression containing Hold:
Use different PlotRangePadding around the drawing:
Specify an overall style for the drawing:
PlotStyle can be combined with VertexRenderingFunction, which has higher priority:
PlotStyle can be combined with EdgeRenderingFunction, which has higher priority:
Properties & Relations (6)
FullForm gives a linear expression similar to TreeForm:
OutputForm of TreeForm gives a textual display of the expression:
Use TreePlot to plot a tree graph:
Use GraphPlot or GraphPlot3D for general undirected graphs:
Use LayeredGraphPlot for hierarchical-style drawing of directed graphs:
The typeset form of TreeForm[expr] is interpreted the same as expr when used in input:
Copy the output and paste it into an input cell. The is interpreted as x2:
When an input evaluates to TreeForm[expr], TreeForm does not appear in the output:
Possible Issues (2)
Compound heads are not laid out as trees:
Even when an output omits TreeForm from the top level, it is not stripped from subexpressions:
The output does not have TreeForm in it:
However, the variable e does have TreeForm in it, which may affect subsequent evaluations:
The product is not evaluated due to the intervening TreeForm:
Assign variables first and then apply TreeForm to the result to maintain computability:
Wolfram Research (1988), TreeForm, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeForm.html (updated 2007).
Wolfram Language. 1988. "TreeForm." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/TreeForm.html.
Wolfram Language. (1988). TreeForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TreeForm.html