fix plot style breakage
[PyX/mjg.git] / faq / other_plotting.rst
blob31cd84aa33b4658069e6572fb71c3d7aa34d6e52
1 ====================
2 Other plotting tasks
3 ====================
5 How can I rotate text?
6 ======================
8 Text can be written at an arbitrary angle by specifying the appropriate
9 transformation as an attribute. The command ::
11    c.text(0, 0, "Text", [trafo.rotate(60)])
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::
18    c.text(0, 0, "Text", [text.halign.center,text.valign.middle,trafo.rotate(60)])
20 How can I clip a canvas?
21 ========================
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::
27    clippath = path.circle(0.,0.,1.)
28    clipobject = canvas.clip(clippath)
29    c = canvas.canvas([clipobject])
31 In this example, the clipping path used to define the clipping object is a 
32 circle.