File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -894,6 +894,13 @@ def __init__(
894894 self .dwg_base = dwg .add (dwg .g (class_ = svg_class ))
895895 self .drawing = dwg
896896
897+ def draw (self , path = None ):
898+ output = self .drawing .tostring ()
899+ if path is not None :
900+ # TODO remove the 'pretty' when we are done debugging this.
901+ self .drawing .saveas (path , pretty = True )
902+ return SVGString (output )
903+
897904 def get_plotbox (self ):
898905 """
899906 Get the svgwrite plotbox, creating it if necessary.
Original file line number Diff line number Diff line change @@ -1964,7 +1964,7 @@ def draw_svg(
19641964 :return: An SVG representation of a tree.
19651965 :rtype: SVGString
19661966 """
1967- draw = drawing .SvgTree (
1967+ d = drawing .SvgTree (
19681968 self ,
19691969 size ,
19701970 time_scale = time_scale ,
@@ -1995,11 +1995,7 @@ def draw_svg(
19951995 preamble = preamble ,
19961996 ** kwargs ,
19971997 )
1998- output = draw .drawing .tostring ()
1999- if path is not None :
2000- # TODO: removed the pretty here when this is stable.
2001- draw .drawing .saveas (path , pretty = True )
2002- return drawing .SVGString (output )
1998+ return d .draw (path )
20031999
20042000 def draw (
20052001 self ,
@@ -7599,7 +7595,7 @@ def draw_svg(
75997595 strictly within an empty region then that tree will not be plotted on the
76007596 right hand side, and the X axis will end at ``empty_tree.interval.left``
76017597 """
7602- draw = drawing .SvgTreeSequence (
7598+ d = drawing .SvgTreeSequence (
76037599 self ,
76047600 size ,
76057601 x_scale = x_scale ,
@@ -7629,11 +7625,7 @@ def draw_svg(
76297625 preamble = preamble ,
76307626 ** kwargs ,
76317627 )
7632- output = draw .drawing .tostring ()
7633- if path is not None :
7634- # TODO remove the 'pretty' when we are done debugging this.
7635- draw .drawing .saveas (path , pretty = True )
7636- return drawing .SVGString (output )
7628+ return d .draw (path )
76377629
76387630 def draw_text (
76397631 self ,
You can’t perform that action at this time.
0 commit comments