don't use python markup for console output (i.e. use indentation < 4)
[PyX/mjg.git] / examples / drawing / path.txt
blob07692f4d4e065490b6735a6c85895603a81ce6c3
1 Basic paths
3 This first path example demonstrates how to create a canvas, how to draw some
4 simple geometric objects onto it and how to write the result into a PostScript
5 or PDF file. ...
7 First we import all top-level symbols of the PyX package by the usual Python
8 import statement. In the further examples we will always use this form of the
9 import statement to make the PyX package available to our scripts.
11 Now we can create a canvas instance `c`, onto which our basic paths are drawn.
12 The later is done by passing some path instances (a line, a rectangle and a
13 circle) to the `strokes` or `fill` methods of the canvas instance we just
14 created and stored in the variable `c`. Finally, we call the `writeEPSfile` and
15 `writePDFfile` methods of the canvas to create an EPS and a PDF file of our
16 drawing. While typically you will only create either a PostScript or a PDF
17 file, in our examples we always create both output formats to have them both
18 available for download.
20 This example, in addition, shows some basics of the PyX coordinate system. The
21 first coordinate (often referred to as `x`) goes horizontally from left to right
22 and the second coordinate (`y`) goes vertically from the bottom to the top. The
23 default unit is `1 cm`. The boundary of the resulting image is calculated
24 automatically.