import svgwrite from svgwrite import cm,mm from math import cos,sin,pi ''' https://stackoverflow.com/questions/13006601/setting-default-units-in-svg-python-svgwrite ''' drawring = svgwrite.Drawing('test.svg', profile='tiny', size=('30cm', '30cm'), viewBox=('0 0 30 30')) ''' You need size and viewBox. Why I don't know, also formatting is insane''' def polycoord(sides,radius,cenx=0,ceny=0,unit='cm',angle=0, *args, **kwargs): x=[] y=[] for n in range(sides): x.append( str((radius *cos(2*pi*n/sides + 2*pi*angle) + cenx))) y.append( str((radius *sin(2*pi*n/sides + 2*pi*angle) + ceny))) z=list(zip(x,y)) return z coords=polycoord(sides=4, radius=2, angle=45, cenx=7, ceny=7) if __name__ == '__main__': hex=drawring.polygon( points=polycoord(sides=6, radius=1, cenx=2, ceny=3), fill="blue", id="hex") square=drawring.polygon(points=polycoord(sides=4, radius=3, cenx=10, ceny=10, angle=30), fill="yellow", id="square") pentagon=drawring.polygon(points=polycoord(sides=5, radius=7, cenx=15, ceny=15, angle=20), fill="none", stroke="black", stroke_width="0.2 ", id="pentagon") drawring.add(square) drawring.add(hex) drawring.add(pentagon) drawring.save()