Skip to content

Instantly share code, notes, and snippets.

@btel
Created April 10, 2014 09:22
Show Gist options
  • Select an option

  • Save btel/10360762 to your computer and use it in GitHub Desktop.

Select an option

Save btel/10360762 to your computer and use it in GitHub Desktop.
#!/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")
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment