home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / !Graph / !Help < prev    next >
Text File  |  1996-11-20  |  4KB  |  104 lines

  1. !Help file for !Graph
  2.  
  3. !Graph is a simple graph plotter designed to demonstrate the use of draw
  4. files in Python.
  5.  
  6. !Graph requires the filer to have seen the !Python application.
  7. It requires the toolbox modules to run. It requires the drawfile module.
  8.  
  9. ================================================================================
  10. Operation of !Graph
  11.  
  12. Graphs are described by text files. The text file is dragged to the iconbar
  13. icon, and the graph is drawn. Errors in the file may produce error reports.
  14. Some of these will cause the file to be abandoned.
  15.  
  16. The graphs may be saved as draw files from the window menu.
  17.  
  18. Here is a typical graph description file:
  19.  
  20. ; !Graph.examples.powers -- test of graph
  21.  
  22. xrange -.25 1
  23. yrange 0 1
  24. grid .2 .2
  25. axes 0 0
  26. title Powers of x
  27.  
  28. colour green
  29. plot x
  30. colour red
  31. plot x*x
  32. colour blue
  33. plot x*x*x
  34. colour yellow
  35. plot pow(x,4)
  36. colour cyan
  37. plot pow(x,5)
  38.  
  39. ;end of file
  40.  
  41. This file and other examples can be found in the directory !Graph.examples.
  42.  
  43. A blank line or a line beginning with a semi-colon is ignored.
  44.  
  45. Other lines start with a command word, and are followed by arguments.
  46.  
  47. Possible commands are
  48.  
  49. xrange <xmin> <xmax>  : set the range of x values plotted (default -1 1)
  50. yrange <ymin> <ymax>  : set the range of y values plotted (default -1 1) 
  51. grid  <xint> <yint>   : plots a grid, with <xint> and <yint> as major 
  52.                         intervals, fainter lines are at a half and a tenth
  53.                         of these intervals.
  54. axes <x> <y>          : plot axes through (<x>,<y>).
  55. title  <text>         : uses <text> as a title!
  56. colour <colour>       : sets the colour for subsequent plotting. <colour> can
  57.                         be a name from [black,white,red,green,blue,yellow,cyan]
  58.                         or a number of the form 0xbbggrr00.
  59.                         The initial colour is black. Grid colours are not
  60.                         affected.
  61. plot <function>       : <function> should be a valid python expression in one
  62.                         variable x, returning a number.
  63.                         The functions in the math module are avaliable.
  64.                         The function must be defined throughout the range
  65.                         of x values.
  66. steps <n>              : <n> indicates the number of x values at which the 
  67.                         fuction is calculated. (default 30).
  68.                         <n> is restricted to between 10 and 1000
  69.  
  70. Notes:
  71.       The commands are obeyed in order. In particular the xrange and yrange
  72. should normally come before all the plotting functions.
  73. Usually there will be at most one of each of the xrange, yrange, grid, axes,
  74. and title commands.
  75.  
  76.       Commands are case sensitive.
  77.  
  78.       If the function has discontinuities, or varies rapidly a large number
  79. of steps will be required to give a reasonable representation of the graph.
  80. Large numbers of steps will be slow and give a big draw file.
  81.  
  82.       The window has an aspect ratio of 5:4. To get a square grid you need
  83.       5*<xint>/<xmax>-<xmin>) = 4*<yint>/(<ymax>-<ymin>).
  84.  
  85.       !Graph is intended as a simple example of wimp programming in Python.
  86. It is by no means a finished application. Some things it needs are,
  87.  
  88.   Automatic and variable step length.
  89.   
  90.   Plotting of partially defined functions.
  91.   
  92.   Labels.
  93.   
  94.   Better argument checking.
  95.   
  96. You can take adding these as an exercise. You will find the main source code
  97. in !Graph.py.graph.
  98.  
  99.  
  100. ================================================================================
  101. Chris Stretch
  102.  
  103.  
  104.