MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

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
 ]


  • Prev by Date: CForm of a synbolic expression
  • Next by Date: Re: The "Go Back" Button doesn't work
  • Previous by thread: how to plot a tree assigning nodes with your own labels
  • Next by thread: How to map a list on function