~ubuntu-branches/debian/sid/pyx/sid

« back to all changes in this revision

Viewing changes to faq/other_plotting.rst

  • Committer: Package Import Robot
  • Author(s): Stuart Prescott
  • Date: 2012-12-17 13:45:12 UTC
  • mfrom: (1.1.4)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: package-import@ubuntu.com-20121217134512-u0w6lrgdowsc1sfu
Tags: 0.12.1-1
* New upstream release
* Update maintainer address.
* Update copyright format URL.
* Bump standards version to 3.9.4 (no changes required).
* Drop postinst that was needed for lenny->squeeze upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
====================
 
2
Other plotting tasks
 
3
====================
 
4
 
 
5
How can I rotate text?
 
6
======================
 
7
 
 
8
Text can be written at an arbitrary angle by specifying the appropriate
 
9
transformation as an attribute. The command ::
 
10
 
 
11
   c.text(0, 0, "Text", [trafo.rotate(60)])
 
12
 
 
13
will write at an angle of 60 degrees relative to the horizontal axis. If no
 
14
pivot is specified (like in this example), the text is rotated around the
 
15
reference point given in the first two arguments of ``text``. In the
 
16
following example, the pivot coincides with the center of the text::
 
17
 
 
18
   c.text(0, 0, "Text", [text.halign.center,text.valign.middle,trafo.rotate(60)])
 
19
 
 
20
How can I clip a canvas?
 
21
========================
 
22
 
 
23
In order to use only a part of a larger canvas, one may want to clip it. This
 
24
can be done by creating a clipping object which is used when creating a canvas
 
25
instance::
 
26
 
 
27
   clippath = path.circle(0.,0.,1.)
 
28
   clipobject = canvas.clip(clippath)
 
29
   c = canvas.canvas([clipobject])
 
30
 
 
31
In this example, the clipping path used to define the clipping object is a 
 
32
circle.