pythonsvgsvgwrite

Rotate path with svgwrite


Let's say I create a drawing with an arrow in SVG with svgwrite:

In [1]: import svgwrite

In [2]: dwg = svgwrite.Drawing('arrow.svg')

In [3]: path = dwg.path(d='M 0,283.45145 H 39.819792 v 13.22917 L 66.278127,270.22229 39.819793,243.76395 v 13.22917 H
   ...: 0 Z')
        dwg.add(path)

In [4]: dwg.save()

Is there a way to rotate it 180° before saving it?

Thanks!


Solution

  • you can add a transform to the path e.g.

     path = dwg.path(d='M 0,283.45145 H 39.819792 v 13.22917 L 66.278127,270.22229 39.819793,243.76395 v 13.22917 H...: 0 Z', transform="rotate(180)")