@@ -367,6 +367,7 @@ def compose_view(bg_svgs, fg_svgs, ref=0, out_file="report.svg"):
367367
368368
369369def _compose_view (bg_svgs , fg_svgs , ref = 0 ):
370+ from svgutils .compose import Unit
370371 from svgutils .transform import SVGFigure , GroupElement
371372
372373 if fg_svgs is None :
@@ -394,11 +395,11 @@ def _compose_view(bg_svgs, fg_svgs, ref=0):
394395
395396 # Compose the views panel: total size is the width of
396397 # any element (used the first here) and the sum of heights
397- fig = SVGFigure (width , heights [:nsvgs ].sum ())
398+ fig = SVGFigure (Unit ( f" { width } px" ), Unit ( f" { heights [:nsvgs ].sum () } px" ))
398399
399400 yoffset = 0
400401 for i , r in enumerate (roots ):
401- r .moveto (0 , yoffset , scale = scales [i ])
402+ r .moveto (0 , yoffset , scale_x = scales [i ])
402403 if i == (nsvgs - 1 ):
403404 yoffset = 0
404405 else :
@@ -413,8 +414,8 @@ def _compose_view(bg_svgs, fg_svgs, ref=0):
413414 else :
414415 newroots = roots
415416 fig .append (newroots )
416- fig .root .attrib .pop ("width" )
417- fig .root .attrib .pop ("height" )
417+ fig .root .attrib .pop ("width" , None )
418+ fig .root .attrib .pop ("height" , None )
418419 fig .root .set ("preserveAspectRatio" , "xMidYMid meet" )
419420
420421 with TemporaryDirectory () as tmpdirname :
0 commit comments