def random_background(node): # Set a random background color for each node partition node.img_style["bgcolor"] = random_color()
def sphere_map(node): # Creates a random color sphere face that will be floating over nodes bubble = faces.CircleFace(random.randint(5,40), random_color(), "sphere") bubble.opacity = 0.7 faces.add_face_to_node(bubble, node, 0, position="float")
if node.is_leaf(): faces.add_face_to_node(faces.AttrFace("name"), node, 0, position="aligned") I.aligned_header.add_face( faces.TextFace("H1"), 0 ) I.aligned_header.add_face( faces.TextFace("H1"), 1 ) I.aligned_header.add_face( faces.TextFace("H1"), 2 ) I.aligned_header.add_face( faces.TextFace("H1111111111111"), 3 ) I.aligned_header.add_face( faces.TextFace("H1"), 4 ) I.aligned_foot.add_face( faces.TextFace("FO1"), 0 ) I.aligned_foot.add_face( faces.TextFace("FO1"), 1 ) I.aligned_foot.add_face( faces.TextFace("FO1"), 2 ) I.aligned_foot.add_face( faces.TextFace("F1"), 3 ) I.aligned_foot.add_face( faces.TextFace("FO1"), 4 ) I.legend.add_face(faces.CircleFace(30, random_color(), "sphere"), 0) I.legend.add_face(faces.CircleFace(30, random_color(), "sphere"), 0) I.legend.add_face(faces.TextFace("HOLA"), 1) I.legend.add_face(faces.TextFace("HOLA"), 1) # Creates a random tree with 10 leaves t2 = Tree() t2.populate(10) # Creates a fixed NodeStyle object containing a TreeFace (A tree image # as a face within another tree image) # t.add_face(faces.TreeFace(t2, I), "branch-right", 0) # Attach the fixed style to the first child of the root node # t.children[0].img_style = style I.rotation = 90
def sphere_map(node): # Creates a random color sphere face that will be floating over nodes bubble = faces.CircleFace(random.randint(5, 40), random_color(), "sphere") bubble.opacity = 0.7 faces.add_face_to_node(bubble, node, 0, position="float")
position="aligned") I.aligned_header.add_face(faces.TextFace("H1"), 0) I.aligned_header.add_face(faces.TextFace("H1"), 1) I.aligned_header.add_face(faces.TextFace("H1"), 2) I.aligned_header.add_face(faces.TextFace("H1111111111111"), 3) I.aligned_header.add_face(faces.TextFace("H1"), 4) I.aligned_foot.add_face(faces.TextFace("FO1"), 0) I.aligned_foot.add_face(faces.TextFace("FO1"), 1) I.aligned_foot.add_face(faces.TextFace("FO1"), 2) I.aligned_foot.add_face(faces.TextFace("F1"), 3) I.aligned_foot.add_face(faces.TextFace("FO1"), 4) I.legend.add_face(faces.CircleFace(30, random_color(), "sphere"), 0) I.legend.add_face(faces.CircleFace(30, random_color(), "sphere"), 0) I.legend.add_face(faces.TextFace("HOLA"), 1) I.legend.add_face(faces.TextFace("HOLA"), 1) # Creates a random tree with 10 leaves t2 = Tree() t2.populate(10) # Creates a fixed NodeStyle object containing a TreeFace (A tree image # as a face within another tree image) # t.add_face(faces.TreeFace(t2, I), "branch-right", 0) # Attach the fixed style to the first child of the root node # t.children[0].img_style = style I.rotation = 90