Graphics state, transformations
The graphics state says something about the way shapes are added to the page. Left untouched, a rectangle drawn at (100, 100) will end up right there. Commands like rotate and translate change the graphics state by adding the transformation to the "state". Rotate first and then translate has different results from translate first and then rotate.
rotate(degrees=0, radians=0)
Add a rotation to the current transformation. Specify either degrees or radians. So after setting this, everything you draw will be at a new angle.
# rotation, angle in degrees rotate(90) rotate(-20) # rotation, angle in radians rotate(radians=3.14)
translate(x, y)
Add a translation to the current transformation.
# example
scale(x=1, y=None)
Add a scale factor to the current transformation. You can set horizontal and vertical scaling seperately.
# scale the stuff that follows by 50% scale(0.5) # scale the stuff that follows # horizontally 50%, vertically by 80% scale(0.5, 0.8)
skew(x=0, y=0)
Add a skew to the current transformation.