~ubuntu-branches/debian/sid/pyx/sid

« back to all changes in this revision

Viewing changes to examples/graphstyles/usesymbol.py

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2011-05-20 00:13:52 UTC
  • mto: (9.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20110520001352-odcuqpdezuusbbw1
Tags: upstream-0.11.1
ImportĀ upstreamĀ versionĀ 0.11.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from pyx import *
 
2
 
 
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]
 
6
 
 
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])])
 
13
 
 
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")