def dendrogram(self): from plot_module import dendrogram from file_module import unpickle dendrogram(unpickle(self.label,"D2"), self.label)
################################################## leaves = dict() for node in branches: leaves[node] = deque() get_leaves(node, leaves[node]) leaves[node] = list(set(leaves[node])) return leaves def plot(self, group, stats, x = [0.36, 0.47, 0.62, 0.75, 0.89]): ''' Plot all leaves over a node''' import matplotlib.pyplot as plt Y = array(map(lambda x: x[0], stats)) e = array(map(lambda x: x[1], stats)) Y = insert(Y, 1, 1e0, axis=1)[group] e = insert(e, 1, 0e0, axis=1)[group] [plt.errorbar(x, y[0], yerr=y[1], color='k', fmt='o-') for y in izip(Y,e)] plt.show() if __name__ == "__main__": from file_module import unpickle test = "q1.2_u0.7_m0.3_MOC3qnum" bt = BTree(unpickle(test,"D2"))