8 text
.preamble(r
"\renewcommand{\familydefault}{\ttdefault}")
13 pf
= graph
.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 palette.__dict__ to get the instances, but we
20 # would loose the ordering ... instead we just parse the file:
21 p
= re
.compile("(?P<id>palette\\.(?P<name>[a-z]+)) += palette\\(.*\\)\n", re
.IGNORECASE
)
22 lines
= imp
.find_module("color", pyx
.__path
__)[0].readlines()
24 for line
in lines
: # we yet don't use a file iterator
27 xaxis
= graph
.linaxis(part
=graph
.linpart(tickdist
=("0.5","0.1"), labeldist
="1"),
28 painter
=graph
.axispainter(innerticklengths
=None, labelattrs
=None))
29 g
= c
.insert(graph
.graphxy(ypos
=y
, width
=10, height
=0.5, x
=xaxis
,
30 x2
=graph
.linkaxis(xaxis
,
31 painter
=graph
.linkaxispainter(innerticklengths
=None,
32 outerticklengths
=graph
.axispainter
.defaultticklengths
)),
33 y
=graph
.linaxis(part
=None)))
34 g
.plot(pf
, graph
.rect(pyx
.color
.palette
.__dict
__[m
.group("name")]))
37 c
.text(10.2, y
+ 0.15, m
.group("id"), text
.size
.footnotesize
)
42 c
.writetofile("palettename", paperformat
="a4")