1.8.1 web.image.graph -- Create graphs

The web.image.graph module is used to create PNG or similar graphs for use on web pages. Currently the module only works with positive values for the axes and requires the presence of the Arial.ttf font. This modules should be considered an early implementation. You should ensure the values you choose produce a nice looking graph because there is very little error checking and the values you choose may not result in the graph displaying correctly. Here as an example showing the useage of the three main classes:
#!/usr/bin/env python

# show python where the web modules are
import sys
sys.path.append('../')
sys.path.append('../../../') 

import web.image.graph

graph = web.image.graph.ScatterGraph(
    xAxis={'max':200, 'unit':20, 'label':'Value 1 /cm^2'}, 
    yAxis={'max':200, 'unit':20, 'label':'Value 2 /cm^2'},
    points=[(0,0),(13,68),(200,200)],
    size=(500, 300),
    bgColor=(240,240,240),
    title='Test Graph'
)
graph.save('scatter.ps')

graph = web.image.graph.BarGraph(
    xAxis={'max':200, 'unit':20, 'label':'Value 1 /cm^2'}, 
    yAxis={'max':200, 'unit':20, 'label':'Value 2 /cm^2'},
    points=[10,20,40,50,200,89, 30, 60, 70, 60],
    size=(500, 300),
    bgColor=(240,240,240),
    title='Test Graph'
)
graph.save('bar.png')

graph = web.image.graph.PieChart(
    points={
        'food':10,
        'numbers':20,
        'numbers2':30,
    },
    size=(500, 300),
    bgColor=(240,240,240),
    title='Test Graph'
)
graph.save('pie.jpg')
Note: The format of the image saved depends on the extension used. Currently supported are '.png', '.jpg', '.ps'. JPEG is a lossy compression method and so the graphics produced as JPEGs may not be as good quality as the others. The receommended format to use is '.png'. ust save your files with a .png extension to have PNG output.
See About this document... for information on suggesting changes.