8 text
.preamble(r
"\renewcommand{\familydefault}{\ttdefault}")
13 pf
= graph
.data
.paramfunction("k", 0, 1, "color, xmin, xmax, ymin, ymax= k, k, 1, 0, 1")
15 # positioning is quite ugly ... but it works at the moment
19 # we could use gradient.__dict__ to get the instances, but we
20 # would loose the ordering ... instead we just parse the file:
22 # see comment in colorname.py
24 p
= re
.compile("(?P<id>gradient\\.(?P<name>[a-z]+)) += [a-z]+gradient\\(.*\\)\n", re
.IGNORECASE
)
25 lines
= imp
.find_module("color", pyx
.__path
__)[0].readlines()
27 for line
in lines
: # we yet don't use a file iterator
30 if firstgraph
is None:
31 xaxis
= graph
.axis
.lin(
32 parter
=graph
.axis
.parter
.lin(tickdists
=["0.5","0.1"], labeldists
=["1"]),
33 painter
=graph
.axis
.painter
.regular(
35 outerticklength
=graph
.axis
.painter
.ticklength
.normal
),
36 linkpainter
=graph
.axis
.painter
.regular(innerticklength
=None, labelattrs
=None))
37 firstgraph
= g
= graph
.graphxy(ypos
=y
, width
=10, height
=0.5, x2
=xaxis
, y
=graph
.axis
.lin(parter
=None))
39 g
= graph
.graphxy(ypos
=y
, width
=10, height
=0.5, x2
=graph
.axis
.linkedaxis(firstgraph
.axes
["x2"]), y
=graph
.axis
.lin(parter
=None))
40 g
.plot(pf
, [graph
.style
.rect(getattr(pyx
.color
.gradient
, m
.group("name")))])
44 c
.text(10.2, y
+ 0.15, m
.group("id"), [text
.size
.footnotesize
])
48 c
.writeEPSfile("gradientname")
49 c
.writePDFfile("gradientname")