I use the svgwrite
library in Python and, because svg has y-axis going downwards while I find it more convenient to have it upwards, I defined a function YInvert
which does the trick for me. However, I have to use this function every time I use a function from svgwrite
, e.g.:
dwg.line((xI,YInvert(yI)), (xII,YInvert(yII)), stroke='blue', stroke_width=0.1)
However, this is uncomfortable. How could I redefine the function dwg.line
(or define some new function LineNew
) to automatically include the YInvert
? I want the argument to be in the same form, by this I mean I could use:
dwg.line((xI,yI), (xII,yII), stroke='blue', stroke_width=0.1)
or
LineNew((xI,yI), (xII,yII), stroke='blue', stroke_width=0.1)
I also use for example
dwg.circle(center=(10,YInvert(10)), r=0.2, fill='black')
so I am looking for something that would apply for a wide variety of arguments, just adding the YInvert
function at the right place(s).