You are on page 1of 1

User Guide Chapter 2 Graphics and Text with pdfgen

(4, 2.5)

(2.5,1) in inches

(0,0) the Origin


Figure 2-3: Moving the origin: the translate method

NOTE Note: As illustrated in the example it is perfectly possible to draw objects or parts of objects "off the page". In
particular a common confusing bug is a translation operation that translates the entire drawing off the visible
area of the page. If a program produces a blank page it is possible that all the drawn objects are off the page.

Shrinking and growing: the scale operation


Another important operation is scaling. The scaling operation canvas.scale(dx,dy) stretches or
shrinks the x and y dimensions by the dx, dy factors respectively. Often dx and dy are the same -- for
example to reduce a drawing by half in all dimensions use dx = dy = 0.5. However for the purposes of
illustration we show an example where dx and dy are different.

def scale(canvas):
canvas.scale(0.75, 0.5)
coords(canvas)

This produces a "short and fat" reduced version of the previously displayed operations.

Page 18

You might also like