0
$\begingroup$

I have the Tree : enter image description here

TreeForm[Criminals["cat" , "dog", "human"["killer", "thug", "macho"]],
  DirectedEdges -> True,
  VertexRenderingFunction -> (Inset[
      Panel@Rotate[#2, -\[Pi]/2], #1] &)] // Rotate[#, \[Pi]/2] & 

Is it possible to mark node macho with a bold frame and mark the path from root to it (example bigger line) ?

Another issue is how do I fix so that when I exported the graph looks like this : (I used paint print screen :( ) enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ Take a look at TreeGraph[] on the docs. It offers much more flexibility $\endgroup$ Commented Nov 24, 2014 at 21:57
  • $\begingroup$ No it doesn't. I can have nodes with same name $\endgroup$
    – TraceKira
    Commented Nov 24, 2014 at 22:27

1 Answer 1

1
$\begingroup$
myVertexes = {"Criminals", "cat", "dog", "human", "killer", "thug", "macho"};

myVertexLabels = 
  Table[myVertexes[[i]] -> 
    Placed[Rotate[
      Panel[myVertexes[[i]], 
       Background -> 
        If[AnyTrue[{"Criminals", "human", "macho"}, 
           # == myVertexes[[i]] &], Orange, Yellow]], -\[Pi]/2], Center], 
           {i, Length[myVertexes]}];

myEdgeShape[el_, ___] := Arrow[el, 0.2];

CriminalTree = 
  TreeGraph[{"Criminals" -> "cat", "Criminals" -> "dog", 
    Style["Criminals" -> "human", Thick, Orange], "human" -> "killer",
     "human" -> "thug", Style["human" -> "macho", Thick, Orange]},
   DirectedEdges -> True,
   EdgeShapeFunction -> myEdgeShape,
   VertexLabels -> myVertexLabels];

Rotate[Image[CriminalTree], \[Pi]/2]

enter image description here

And here is a direct screen shot of this figure inserted into a Pages document, showing it is in proper orientation.

enter image description here

And here is a direct screen shot of this figure inserted into an MS Word document, showing it in proper orientation.

enter image description here

And here is a direct screen shot of this figure inserted into an Adobe Illustrator document, showing it in proper orientation

enter image description here

And here is a direct screen shot of this figure inserted in MS Powerpoint document, showing it in proper orientation.

enter image description here

$\endgroup$
7
  • $\begingroup$ try adding a tab at the beginning of your code to typeset; FYI it does not work in its current form. $\endgroup$
    – chris
    Commented Nov 25, 2014 at 20:17
  • $\begingroup$ The code is giving an error: The specified setting for the option PanelBoxOptions, Background cannot be used. $\endgroup$
    – TraceKira
    Commented Nov 25, 2014 at 21:40
  • $\begingroup$ The option works fine in v. 10.0.0. $\endgroup$ Commented Nov 25, 2014 at 21:50
  • $\begingroup$ The Vertex must be also rotated :( $\endgroup$
    – TraceKira
    Commented Nov 25, 2014 at 22:41
  • 1
    $\begingroup$ I copy as pdf and bitmap and paste into Adobe products, Preview on the Mac and all my imaging programs without problems. (I use neither Paintbrush nor Windows.) Try copying or Exporting it as a pdf or bitmap or other format. At the very worst (and you shouldn't have to do this) take a screen shot of the graph. $\endgroup$ Commented Nov 26, 2014 at 16:56

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.