home *** CD-ROM | disk | FTP | other *** search
- !Help file for !Graph
-
- !Graph is a simple graph plotter designed to demonstrate the use of draw
- files in Python.
-
- !Graph requires the filer to have seen the !Python application.
- It requires the toolbox modules to run. It requires the drawfile module.
-
- ================================================================================
- Operation of !Graph
-
- Graphs are described by text files. The text file is dragged to the iconbar
- icon, and the graph is drawn. Errors in the file may produce error reports.
- Some of these will cause the file to be abandoned.
-
- The graphs may be saved as draw files from the window menu.
-
- Here is a typical graph description file:
-
- ; !Graph.examples.powers -- test of graph
-
- xrange -.25 1
- yrange 0 1
- grid .2 .2
- axes 0 0
- title Powers of x
-
- colour green
- plot x
- colour red
- plot x*x
- colour blue
- plot x*x*x
- colour yellow
- plot pow(x,4)
- colour cyan
- plot pow(x,5)
-
- ;end of file
-
- This file and other examples can be found in the directory !Graph.examples.
-
- A blank line or a line beginning with a semi-colon is ignored.
-
- Other lines start with a command word, and are followed by arguments.
-
- Possible commands are
-
- xrange <xmin> <xmax> : set the range of x values plotted (default -1 1)
- yrange <ymin> <ymax> : set the range of y values plotted (default -1 1)
- grid <xint> <yint> : plots a grid, with <xint> and <yint> as major
- intervals, fainter lines are at a half and a tenth
- of these intervals.
- axes <x> <y> : plot axes through (<x>,<y>).
- title <text> : uses <text> as a title!
- colour <colour> : sets the colour for subsequent plotting. <colour> can
- be a name from [black,white,red,green,blue,yellow,cyan]
- or a number of the form 0xbbggrr00.
- The initial colour is black. Grid colours are not
- affected.
- plot <function> : <function> should be a valid python expression in one
- variable x, returning a number.
- The functions in the math module are avaliable.
- The function must be defined throughout the range
- of x values.
- steps <n> : <n> indicates the number of x values at which the
- fuction is calculated. (default 30).
- <n> is restricted to between 10 and 1000
-
- Notes:
- The commands are obeyed in order. In particular the xrange and yrange
- should normally come before all the plotting functions.
- Usually there will be at most one of each of the xrange, yrange, grid, axes,
- and title commands.
-
- Commands are case sensitive.
-
- If the function has discontinuities, or varies rapidly a large number
- of steps will be required to give a reasonable representation of the graph.
- Large numbers of steps will be slow and give a big draw file.
-
- The window has an aspect ratio of 5:4. To get a square grid you need
- 5*<xint>/<xmax>-<xmin>) = 4*<yint>/(<ymax>-<ymin>).
-
- !Graph is intended as a simple example of wimp programming in Python.
- It is by no means a finished application. Some things it needs are,
-
- Automatic and variable step length.
-
- Plotting of partially defined functions.
-
- Labels.
-
- Better argument checking.
-
- You can take adding these as an exercise. You will find the main source code
- in !Graph.py.graph.
-
-
- ================================================================================
- Chris Stretch
-
-
-