~ubuntu-branches/ubuntu/trusty/pyx/trusty

« back to all changes in this revision

Viewing changes to examples/bargraphs/stacked.py

  • Committer: Bazaar Package Importer
  • Author(s): Graham Wilson
  • Date: 2004-12-25 06:42:57 UTC
  • Revision ID: james.westby@ubuntu.com-20041225064257-31469ij5uysqq302
Tags: upstream-0.7.1
ImportĀ upstreamĀ versionĀ 0.7.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# To stack bars on top of each other, you can add
 
2
# stackedbarpos styles and and bars to the styles.
 
3
# The stackbarpos need to get different column names
 
4
# each time to access new stack data. This example
 
5
# also adds text styles to the bars, which just
 
6
# repeat the value column data here, but they could
 
7
# refer to other columns as well.
 
8
 
 
9
from pyx import *
 
10
 
 
11
g = graph.graphxy(width=8, x=graph.axis.bar())
 
12
g.plot(graph.data.file("bar.dat", xname=0, y=2, stack=3),
 
13
       [graph.style.bar(),
 
14
        graph.style.text("y"),
 
15
        graph.style.stackedbarpos("stack"),
 
16
        graph.style.bar([color.rgb.green]),
 
17
        graph.style.text("stack")])
 
18
g.writeEPSfile("stacked")