Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Question re: graphics primitives

  • To: mathgroup at
  • Subject: [mg77653] Re: [mg77593] Question re: graphics primitives
  • From: Carl Woll <carlw at>
  • Date: Thu, 14 Jun 2007 05:34:04 -0400 (EDT)
  • References: <>

Ghuloum, Anwar wrote:

>Is it possible to put conditional clauses (i.e. If[.]) in the
>VertexRenderingFunction option for TreeForm (or any primitive that this
>option applies to)? I wanted to selectively label vertices based on label
>content, but Mathematica was complaining that "If" is not a graphics
>primitive or directive.
>(Basically, I'm trying to draw a tree where only the leaves have labels:
>TreeForm[{{a, b}, {c, {d}}},  VertexRenderingFunction -> (If[#2 == List, {},
>Text[#2, #1]] &)]
Try using === instead of ==:

TreeForm[{{a, b}, {c, {d}}}, VertexRenderingFunction -> (If[#2 === List, {},
Text[#2, #1]] &)]

Alternatively, use the 4 argument form of If. Your problem was that If 
couldn't determine whether a==List was True or False. Hence it was left 
unevaluated, and the result wasn't a graphics directive.

Carl Woll
Wolfram Research

>In general, I was having a hard time finding information at the
>documentation center on the limitations on how I can generate graphics
>primitives.but perhaps I'm not looking in the right place.
>Thanks in advance!
>Anwar Ghuloum
>Microprocessor Technology Lab, Intel

  • Prev by Date: Re: Changed order of multiplication in Times[a, b, c] in version
  • Next by Date: Re: Overly complicated reductions?
  • Previous by thread: Question re: graphics primitives
  • Next by thread: Re: Question re: graphics primitives