node.add_face(profileFace, 1, position = "aligned") # Add the color bar (kind of hacked in from matplotlib since there is no convenient way to get it from ETE) # I could generate this in situ... for now I just have a file I like and run with it. # This doesn't match exactlty becuase I don't have the time or motivation now to mess with QT to do it. # It should be pretty close though... from ete3 import ImgFace imgloc = os.path.join(locateRootDirectory(), "src", "internal", "Colormap.png") F1 = faces.TextFace("Minimum: %1.1f" %(matrix_min), ftype="Times", fsize=32 ) F2 = faces.ImgFace(imgloc) F3 = faces.TextFace("%1.1f : Maximum" %(matrix_max), ftype="Times", fsize=32 ) ts.legend.add_face(F1, 0) ts.legend.add_face(F2, 1) ts.legend.add_face(F3, 2) # Put it on the Bottom-left ts.legend_position = 3 if options.textfile is not None: fid = open(options.textfile, "r") # Our formatting requirements are the same as ETE's, which are: # 1: Tab delimited, # 2: #names in first row followed by titles, # 3: Node names in the first column followed by all the other data title_row = fid.readline().strip("\r\n").split("\t") n_titles = len(title_row) for idx, title in enumerate(title_row[1:]): coltitle = TextFace(" " + str(title) + " ", ftype="Times", fsize=int(options.fontsize*1.2), fstyle = 'Bold') coltitle.hz_align = True # Organism name has column 0 ts.aligned_header.add_face(coltitle, column=idx+1) for line in fid: