0
$\begingroup$

I have the code :

myVertexes = {"xxx", "yyy", "Block3", "p5", "Block2", 
   "Block1", "p3", "p2", "p1"};
myVertexLabels =
  Table[myVertexes[[i]] ->
    Placed[Rotate[
      Panel[myVertexes[[i]],
       Background ->
        If[AnyTrue[{"Criminals", "human", "macho"},
          # == myVertexes[[i]] & ], Orange, Orange]], -\[Pi]/2], 
     Center],
            {i, Length[myVertexes]}];

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

TreeCFGNVM = 
  TreeGraph[{"xxx" -> "yyy", "yyy" -> "Block3", 
    "yyy" -> "Block2", "yyy" -> "Block1", 
    "Block3" -> "p5", "Block1" -> "p1", "Block1" -> "p2", 
    "Block1" -> "p3"},
   DirectedEdges -> True, EdgeShapeFunction -> myEdgeShape,
   VertexLabels -> myVertexLabels];

TreeCFGNVM = Rotate[Image[TreeCFGNVM], \[Pi]/2]

Is it possible to move the note xxx on the left of yyy ? (also I wonder why the picture of the tree is so low resolution ?)

enter image description here

$\endgroup$
4
$\begingroup$
myVertexes = {"xxx", "yyy", "Block3", "p5", "Block2", "Block1", "p3", "p2", "p1"};
myVertexLabels = 
  Table[myVertexes[[i]] -> Placed[Panel[myVertexes[[i]]], Center], {i, Length[myVertexes]}];

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

TreeCFGNVM = 
 TreeGraph[{"xxx" -> "yyy", "yyy" -> "Block3", "yyy" -> "Block2", 
           "yyy" -> "Block1", "Block3" -> "p5", "Block1" -> "p1", 
           "Block1" -> "p2", "Block1" -> "p3"}, DirectedEdges -> True, 
            EdgeShapeFunction -> myEdgeShape, VertexLabels -> myVertexLabels, 
            ImageSize -> 500, 
            GraphLayout -> {"LayeredEmbedding", "RootVertex" -> "xxx", 
            "Orientation" -> "Left"}, 
            ImagePadding -> 20]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thank you Sir for the answer ! :) You saved me a lot of trouble $\endgroup$ – TraceKira Nov 27 '14 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.