def get_dims_from_tree_size(self):
ntips = len(self.ttree)<EOL>if self.style.orient in ("<STR_LIT:right>", "<STR_LIT:left>"):<EOL><INDENT>if not self.style.height:<EOL><INDENT>self.style.height = max(<NUM_LIT>, min(<NUM_LIT:1000>, <NUM_LIT> * ntips))<EOL><DEDENT>if not self.style.width:<EOL><INDENT>self.style.width = max(<NUM_LIT>, min(<NUM_LIT>, <NUM_LIT> * ntips))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not self.style.height:<EOL><INDENT>self.style.height = max(<NUM_LIT>, min(<NUM_LIT>, <NUM_LIT> * ntips))<EOL><DEDENT>if not self.style.width:<EOL><INDENT>self.style.width = max(<NUM_LIT>, min(<NUM_LIT:1000>, <NUM_LIT> * ntips))<EOL><DEDENT><DEDENT>
Calculate reasonable canvas height and width for tree given N tips