I'd like to implement a function FunctionTreeForm which takes an arbitrary complex function and renders all the captionable subfunctions in a TreeForm.
- Explanation
If we take e.g. a function:
TreeForm[Exp[-(x/3)^2]*Cos[2 x + x^2/3]]
the corresponding TreeForm is:

If we tokenize this function into its subfunctions and plot them seperately:
{Plot[Exp[-(x/3)^2]*Cos[2 x + x^2/3], {x, -2 \[Pi], 2 \[Pi]},
PlotLegends -> "Expressions"],
Plot[E^(-(x^2/9)), {x, -2 \[Pi], 2 \[Pi]}, PlotLegends -> "Expressions"],
Plot[Cos[2 x + x^2/3], {x, -2 \[Pi], 2 \[Pi]}, PlotLegends -> "Expressions"],
Plot[2 x + x^2/3, {x, -2 \[Pi], 2 \[Pi]}, PlotLegends -> "Expressions"]}
we get:

What I'd like to do is to traverse the corresponding TreeForm and check if a Node is not an Atomic. If it is not I'd suspect it is a function. After collecting all these plots I'd like to display the corresponding TreeForm as a plot of the main function and all its sub-functions in TreeForm.
I played around with Level[] etc. but did not came to a solution that does reliable tokenisation of a function definition into sub-functions and I totally lack any idea how to transfer these into a Tree representation.
- Why I think this could be a feasible functionality
I think in education this FunctionTreeFrom could give a good clue how a rather complicated function is actually assembled from its sub-functions.
I hope this is an interesting question and I'm eager to learn how to tackle problems like that.

VertexRenderingFunctionthatInsets the plot – ssch Jan 18 '13 at 15:02