Skip to content

Commit 3773012

Browse files
authored
Merge pull request #620 from mgxd/fix/svgutils
FIX: Update svgutils after breaking API changes
2 parents 2209cd6 + 1f00278 commit 3773012

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

niworkflows/viz/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ def compose_view(bg_svgs, fg_svgs, ref=0, out_file="report.svg"):
367367

368368

369369
def _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:

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ install_requires =
4040
scikit-image
4141
scipy
4242
seaborn
43-
svgutils != 0.3.2
43+
svgutils >= 0.3.4
4444
transforms3d
4545
templateflow >= 0.6
4646
test_requires =

0 commit comments

Comments
 (0)