def layout2(node): #node.img_style["size"] = random.randint(40, 200) if hasattr(node, "size"): f = faces.PieChartFace([100], node.size[0], node.size[1], ["blue"]) faces.add_face_to_node(f, node, 0, position="branch-top") faces.add_face_to_node(f, node, 0, position="branch-bottom") #f = faces.PieChartFace([100], node.size[0]*3, node.size[0]*3, ["blue"]) #faces.add_face_to_node(f, node, 0, position="branch-right") f.border.width = 0 node.img_style["size"] = 10 node.img_style["shape"] = "square" node.img_style["bgcolor"] = random_color() node.img_style["hz_line_width"] = 0 node.img_style["vt_line_width"] = 0
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")
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")
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