Example (watch the vertex labels):

aTree = TreeGraph[{"a" -> "b", "a" -> "c"}, VertexLabels -> "Name"]

Mathematica graphics

(* {a, b, c} *)


TreePlot[aTree, VertexLabeling -> True]

Mathematica graphics


Is there some justification for TreePlot's ignoring the names/labels in the original TreeGraph?

(It's perversity like this that makes me most resent Mathematica's laconic documentation style...)

BTW, eventually, after almost 2 hours of searching the documentation and trial-and-error, I figured out that

TreePlot[Rule @@@ EdgeList[aTree], DirectedEdges -> True, VertexLabeling -> True]

will do what I want. This is to emphasize that this question is less about getting the right output from TreePlot than about avoiding monumental wastes of time like this one in the future. (E.g. a clarification regarding the relationship between the various Graph-related functions may do the job.)

  • $\begingroup$ @kglr For those like myself who read questions ordered by recent activity, edits to a couple dozen in a short time span has a disconcerting way of burying things that might be of interest. Is there a compelling need for so much editing of past posts? $\endgroup$ Dec 22, 2020 at 2:46
  • $\begingroup$ Sorry @Daniel. Didn't realize questions with my edits filled up the top page. Frustrated by difficulties of searching for posts that I am sure I have seen recently, I have settled on filtering by tags -- and. more often, I was able to find what I searched if I used multiple tags. I noticed, however, that many posts lacked obvious tags. That's why I have been editing tags last few days . I will stop for now. Sorry again. $\endgroup$
    – kglr
    Dec 22, 2020 at 4:07
  • $\begingroup$ @kglr Was not sure why you were editing. Adding tags is of course very useful. I guess if it could just be not quite so frequently... $\endgroup$ Dec 22, 2020 at 13:19

3 Answers 3


TreePlot predates Graph. Only in version 10 was it updated to handle Graph according to the documentation. Since Graph supports more advanced functionality than TreePlot it is unsurprising that only a subset is supported by the latter, and VertexLabels is not supported. If you convert the Graph to an older, more basic format TreePlot will work:

TreePlot[Rule @@@ EdgeList[aTree], VertexLabeling -> True]

enter image description here

Yes, it would be nice if this were handled automatically. However other parts of the system that are in greater need of attention (IMO) still await update, so again I am not suprised.


An update for the record. The same situation described by Mr. Wizard appears to be the case in version 11.2. However, using Graph with GraphLayout->"LayeredEmbedding" can achieve the desired result.



The why part is explained nicely in this answer by Szabolcs in a closely related Q/A:

  • In 11.3 (and probably all the way back to at least 10.0), GraphPlot also takes Graph expressions as input. But it handles Graphs by converting them to a matrix (not a rule list!) first. Thus the vertex names are lost, and it will use vertex indices instead.

A hidden option ("VertexNames") as a workaround:

Row[{aTree = TreeGraph[{"a" -> "b", "a" -> "c"}, VertexLabels -> "Name"],
  TreePlot[aTree, VertexLabeling -> True, "VertexNames" -> VertexList[aTree]]}, 

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.