The general schema for creating graphs is as follows:
from graphite import *
g = Graph()
data = loadTable('karin.dat',' ')
g.datasets.append(Dataset(data))
genOutput(g,'PS')
After creating the very simple graph it is then possibe to export all of this graph's settings in a string. If this string is written to a file, we can then change all the properties of the graph. All of the graph properties can be printed to a file using the following code.
f = open('settings.py','w')
f.write(g.exportString('g'))
f.close()
That file can them be edited to make any changes to the graph which are desired. Below are some example properties as generated from exportString.
# list of PlotFormat objects which will be used in a round-robin fashion by the Datasets g.formats = [PointPlot()] # style used to draw the lines, or None if no lines are desired g.formats[0].lineStyle = LineStyle(width=1, color=Color(0.00,0.00,0.00), kind=SOLID)
By making the changes to various properties listed in the settings file and then executing the edited file, we were able to change figure 1 to figure 2.
f = open('settings.py')
commands = f.readlines()
f.close()
import string
commands = string.join(commands,'')
exec(commands)
genOutput(g,'PS',size=(400,250))
Figure 3 and figure 4 show two more examples of graphs which can be generated with Graphite.