added an example for varying the symbol and line styles
[PyX/mjg.git] / examples / graphstyles / usesymbol.py
blob91c04a2d83b83d706d839f2b66b1430dc2cb3974
1 from pyx import *
3 # colors and symbols to use (alternatingly)
4 colors = [color.rgb.red, color.rgb.green, color.rgb.blue, color.gray.black]
5 symbols = [graph.style._diamondsymbol, graph.style._trianglesymbol, graph.style._circlesymbol]
7 # create the graph styles to be used below
8 symbol = graph.style.symbol(symbol=attr.changelist(symbols),
9 symbolattrs=[deco.stroked.clear,
10 attr.changelist([deco.filled([cc]) for cc in colors])])
11 line = graph.style.line(lineattrs=[attr.changelist(colors),
12 attr.changelist([style.linestyle.solid])])
14 g = graph.graphxy(width=8, x=graph.axis.linear(min=0, max=1))
15 g.plot([graph.data.function("y(x) = x**%d" % i, points=8) for i in range(1, 7)],
16 styles=[line, symbol])
17 g.writeEPSfile("usesymbol")
18 g.writePDFfile("usesymbol")