0

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

TraceKira
  • 363
  • 1
  • 8

1 Answers1

4
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

Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453