Re: how to plot a tree assigning nodes with your own labels
- To: mathgroup at smc.vnet.net
- Subject: [mg97562] Re: how to plot a tree assigning nodes with your own labels
- From: Raffy <raffy at mac.com>
- Date: Sun, 15 Mar 2009 05:29:00 -0500 (EST)
- References: <gpg1lj$cpk$1@smc.vnet.net>
On Mar 14, 3:41 am, Sunt <SunTing... at gmail.com> wrote:
> When I use the Funtion TreePlot[] with option VertexLabeling -> True,
> surely there would be labels displayed. However, if I want to
> designate different nodes with same label, the tree looks not so nice.
> How could I do?
> Thanks a lot!
I'm not sure what you're asking for.
You can use VertexRenderingFunction to design how the vertexes are
displayed.
vertex[pt : {x_, y_}, tag_, index_] :=
Text[ToString[tag] <> " (" <> ToString@Head[tag] <> ")", pt];
TreePlot[
{1 -> a, 1 -> 2, 2 -> "apple", a -> 7, 2 -> "log", a -> "six",
1 -> "A", "A" -> four, "A" -> Log},
VertexLabeling -> True,
VertexRenderingFunction -> vertex
]