Introduction to the Figure Package - Creating Figures
[Introduction to figPac  | figPac API  ]

Creating Figures

A typical figure is created by Once the figure has been prepared it still has to be embedded in a program that displays it to the computer screen or writes it to a PostScript file. Here are a number of archetypical examples, with instructions on how to use them.

In an attempt to reduce the number of keystrokes required to prepare Figures, I have also prepared a "template" class called Template that has built in typical methods for displaying figures. The code that prepares a Figure using this class has the form


import figPac.* ;
import java.applet.* ;
import java.awt.* ;

public class figureName extends Template {

     static {
          templateClass = new figureName() ;
     }

     public static void setup() {
          initialization code
     }
     
     public static void prepareFigure(Figure canvas) {
          figure preparation code 
     }
}

The method setup() is used to set the values of various parameters. It may be empty if all the default values are acceptable. The possible variables and their default values are

     filePrefix = "myfig" ;    // used as the prefix for any ps or lbl files written
     outputPsFile = true ;
     outputLblFile = true ;
     xsize = 3 ;   // in inches
     ysize = 3 ;   // in inches
     xmin = -100 ;
     xmax = 100 ;
     ymin = -100 ;
     ymax = 100 ;
     useZoom = true ;
     useDrag = true ;
     showCoords = true ;
     showCanvasBoundary = true ;

The method prepareFigure(Figure canvas) is of course used for the actual figure preparation code. I have included in Template a large number of "shortform" methods

                       fSomething(arguments) ;
whose action is precisely
                      canvas.append( new fSomething(arguments) )  ;
as well as some shortform variables liked FILLED which is equal to Figure.FILLED, fCurve.FILLED, fPolygon.FILLED etc.
[Introduction to figPac  | figPac API  ]