File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -894,6 +894,13 @@ def __init__(
894
894
self .dwg_base = dwg .add (dwg .g (class_ = svg_class ))
895
895
self .drawing = dwg
896
896
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
+
897
904
def get_plotbox (self ):
898
905
"""
899
906
Get the svgwrite plotbox, creating it if necessary.
Original file line number Diff line number Diff line change @@ -1965,7 +1965,7 @@ def draw_svg(
1965
1965
:return: An SVG representation of a tree.
1966
1966
:rtype: SVGString
1967
1967
"""
1968
- draw = drawing .SvgTree (
1968
+ svgtree = drawing .SvgTree (
1969
1969
self ,
1970
1970
size ,
1971
1971
time_scale = time_scale ,
@@ -1996,11 +1996,7 @@ def draw_svg(
1996
1996
preamble = preamble ,
1997
1997
** kwargs ,
1998
1998
)
1999
- output = draw .drawing .tostring ()
2000
- if path is not None :
2001
- # TODO: removed the pretty here when this is stable.
2002
- draw .drawing .saveas (path , pretty = True )
2003
- return drawing .SVGString (output )
1999
+ return svgtree .draw (path )
2004
2000
2005
2001
def draw (
2006
2002
self ,
@@ -7600,7 +7596,7 @@ def draw_svg(
7600
7596
strictly within an empty region then that tree will not be plotted on the
7601
7597
right hand side, and the X axis will end at ``empty_tree.interval.left``
7602
7598
"""
7603
- draw = drawing .SvgTreeSequence (
7599
+ svgtreesequence = drawing .SvgTreeSequence (
7604
7600
self ,
7605
7601
size ,
7606
7602
x_scale = x_scale ,
@@ -7630,11 +7626,7 @@ def draw_svg(
7630
7626
preamble = preamble ,
7631
7627
** kwargs ,
7632
7628
)
7633
- output = draw .drawing .tostring ()
7634
- if path is not None :
7635
- # TODO remove the 'pretty' when we are done debugging this.
7636
- draw .drawing .saveas (path , pretty = True )
7637
- return drawing .SVGString (output )
7629
+ return svgtreesequence .draw (path )
7638
7630
7639
7631
def draw_text (
7640
7632
self ,
You can’t perform that action at this time.
0 commit comments