Created
April 10, 2014 09:22
-
-
Save btel/10360762 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import svgutils.transform as sg | |
| import sys | |
| import os | |
| #create new SVG figure | |
| fig = sg.SVGFigure("15cm", "10cm") | |
| # load figures | |
| def prefix_classnames(fname, idd=''): | |
| with file(fname) as fid: | |
| server = fid.read() | |
| import re | |
| prefix, ext = os.path.splitext(fname) | |
| server = re.sub('(st[0-9]+)', prefix+idd+r'-\1', server) | |
| return sg.fromstring(server) | |
| fig2=sg.fromfile('server.svg') | |
| fig3 = sg.fromfile('server.svg') | |
| # get the plot objects | |
| plot2 = fig2.getroot() | |
| plot2.moveto(150, 130, scale=0.5) | |
| plot3 = fig3.getroot() | |
| plot3.moveto(180, 150, scale=0.5) | |
| fig.append([plot2]) | |
| # save generated SVG file | |
| fig.save("infrastructure.svg") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment