Skip to content

Commit d7cfffd

Browse files
committed
Make SVG standard widths and heights available in the class definition
1 parent e8e40ee commit d7cfffd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/tskit/drawing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,8 @@ class SvgPlot:
860860

861861
text_height = 14 # May want to calculate this based on a font size
862862
line_height = text_height * 1.2 # allowing padding above and below a line
863+
default_width = 200 # for a single tree
864+
default_height = 200
863865

864866
def __init__(
865867
self,
@@ -1361,7 +1363,7 @@ def __init__(
13611363
use_skipped = np.append(np.diff(self.tree_status & OMIT_MIDDLE == 0) == 1, 0)
13621364
num_plotboxes = np.sum(np.logical_or(use_tree, use_skipped))
13631365
if size is None:
1364-
size = (200 * int(num_plotboxes), 200)
1366+
size = (self.default_width * int(num_plotboxes), self.default_height)
13651367
if max_time is None:
13661368
max_time = "ts"
13671369
if min_time is None:
@@ -1674,7 +1676,7 @@ def __init__(
16741676
stacklevel=4,
16751677
)
16761678
if size is None:
1677-
size = (200, 200)
1679+
size = (self.default_width, self.default_height)
16781680
if symbol_size is None:
16791681
symbol_size = 6
16801682
self.symbol_size = symbol_size

0 commit comments

Comments
 (0)