def svg(self, fName=None, width=500, putInternalNodeNamesOnBranches=0): """Make a basic svg drawing of self. The 'width' is in postscript points (??). -- does that work with svg? By default, internal node names label the node, where the node name goes on the right of the node. You can make the node name label the branch by setting 'putInternalNodeNamesOnBranches'. """ gm = ["Tree.svg()"] if not self.preAndPostOrderAreValid: self.setPreAndPostOrder() from TreePicture import TreePicture p = TreePicture(self) p.addToBrLen = 0.0 p.width = width p.yScale = 17.0 p.xScale = None p.pointsPerLetter = 8.0 # was 6.0 p.textSize = 11 p.labelTextSize = 8 p.putInternalNodeNamesOnBranches = putInternalNodeNamesOnBranches p.xOrigin = 5.0 p.setPos() p.svg = True s = p.vectorString() if not fName: if self.name: fName = "%s.svg" % self.name else: fName = "%i.svg" % os.getpid() # if not fName.endswith('.svg'): # fName = '%s.svg' % fName f = file(fName, "w") f.write(s) f.close()
def svg(self, fName=None, width=500, putInternalNodeNamesOnBranches=0): """Make a basic svg drawing of self. The 'width' is in postscript points (??). -- does that work with svg? By default, internal node names label the node, where the node name goes on the right of the node. You can make the node name label the branch by setting 'putInternalNodeNamesOnBranches'. """ gm = ['Tree.svg()'] if not self.preAndPostOrderAreValid: self.setPreAndPostOrder() from TreePicture import TreePicture p = TreePicture(self) p.addToBrLen = 0.0 p.width = width p.yScale = 17.0 p.xScale = None p.pointsPerLetter = 8.0 # was 6.0 p.textSize=11 p.labelTextSize=8 p.putInternalNodeNamesOnBranches = putInternalNodeNamesOnBranches p.xOrigin = 5.0 p.setPos() p.svg = True s = p.vectorString() if not fName: if self.name: fName = '%s.svg' % self.name else: fName = '%i.svg' % os.getpid() #if not fName.endswith('.svg'): # fName = '%s.svg' % fName f = file(fName, 'w') f.write(s) f.close()