File: general_aspects_plotting.rst

package info (click to toggle)
pyx3 0.17-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,328 kB
  • sloc: python: 27,656; makefile: 225; ansic: 130; sh: 17
file content (28 lines) | stat: -rw-r--r-- 1,144 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
====================================
General aspects of plotting with PyX
====================================

How do I generate multipage output?
===================================

With versions 0.8 and higher it is possible to produce multipage output,
i.e. a Postscript or PDF file containing more than one page. In order to
achieve this, one creates pages by drawing on a canvas as usual and 
appends them in the desired order to a document from which Postscript or
PDF output is produced. The following example serves as an illustration::

   from pyx import *

   d = document.document()
   for i in range(3):
       c = canvas.canvas()
       c.text(0, 0, "page %i" % (i+1))
       d.append(document.page(c, paperformat=document.paperformat.A4,
                                 margin=3*unit.t\_cm,
                                 fittosize=1))
   d.writePSfile("multipage")

Here, ``d`` is the document into which pages are inserted by means of the
``append`` method. When converting from a canvas to a document page, the page
properties like the paperformat are specified. In the last line, output is
produced from document ``d``.