use the same coordinate space for the origin point, even though this is irrelevant...
[PyX.git] / examples / drawing / style.txt
blobeccb59d85d35ca5b126fd6ba0ed3c2f52866ea91
1 Stroke and fill attributes
3 The previous example anticipated a simple case of setting an attribute when
4 stroking paths. This example shows a few more use-cases.
6 Attributes can be passed in a list as the second optional argument of the
7 `stroke` or `fill` methods of a canvas instance. ... The attributes themselves are
8 instances of certain attribute classes. A full list is available in the manual.
10 In general, some useful attribute instances are predefined as class attributes
11 of the corresponding attribute class. In the given example, the
12 `style.linewidth.THICK`, `style.linestyle.dashed`, `style.linecap.round`,
13 `color.rgb.red`, `color.rgb.green`, and `color.rgb.blue` are just some examples of
14 this type of attribute instances. In contrast, `style.linewidth(0.2)` creates a
15 new style instance for the given parameters.
17 !! The linewidth instance created by `style.linewidth(0.2)` is different from the
18 predefined linewidth instances in PyX in its use of ''user'' units. In the example
19 ''Adding and joining paths'' of section ''Path features'', the linewidth is
20 scaled independently of the ''user'' units, but if you try to double all linewidth
23     unit.set(wscale=2)
25 in the beginning of the script, our self-defined linewidth will not be scaled.
26 To obtain the proper scaling behaviour it would be necessary to attach the
27 ''width'' unit by using
29     style.linewidth(0.2*unit.w_cm)