TreePlot
- To: mathgroup at smc.vnet.net
- Subject: [mg132390] TreePlot
- From: Marco Gabiccini <m.gabiccini at ing.unipi.it>
- Date: Thu, 6 Mar 2014 02:06:05 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
Dear all,
I am trying to obtain a nice visualization of generic trees in
Mathematica for mechanism analysis.
I have been able to use something like:
treeStructure = {{0, 1}, {1, 2}, {1, 3}, {3, 5}, {0, 4}, {4, 6}, {4,
7}, {4, 8}};
jointList = Map[Last, treeStructure];
edgeList = MapThread[Rule,
{Map[DirectedEdge @@ # &, treeStructure],
jointList}
];
g = TreeGraph[
Map[DirectedEdge @@ # &, treeStructure],
VertexLabels -> "Name",
GraphRoot -> 0,
EdgeLabels -> edgeList,
VertexSize -> 0.15, EdgeStyle -> Thick,
EdgeLabelStyle -> Directive[Red, Bold, 16],
VertexLabelStyle -> Directive[Black, 14]]
and all is fine. However, I was trying to exploit the apparently more
freedom given by the command TreePlot, e.g. to create a small white
frame behind the names of the edges so that the text does not collide
with the edge itself, have the tree grow from the bottom up, etc., but
I am facing the problem that it seems that TreePlot overrides the names
given to the nodes (e.g, my root node must be zero and it is
automatically renamed 1) and there seems to be no smart function like
that is TreeGraph VertexLabels->"Name".
Any hint about how the get, at the same time, the best of both commands?
Or, at least, have a better visualization using TreeGraph?
Thanks,
Marco
- Follow-Ups:
- Re: TreePlot
- From: Bob Hanlon <hanlonr357@gmail.com>
- Re: TreePlot