diff options
Diffstat (limited to 'grapheps.txi')
-rw-r--r-- | grapheps.txi | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/grapheps.txi b/grapheps.txi index d587107..b0acc81 100644 --- a/grapheps.txi +++ b/grapheps.txi @@ -3,7 +3,7 @@ @noindent This is a graphing package creating encapsulated-PostScript files. Its motivations and design choice are described in -@url{http://swissnet.ai.mit.edu/~jaffer/Docupage/grapheps} +@url{http://swiss.csail.mit.edu/~jaffer/Docupage/grapheps} @noindent A dataset to be plotted is taken from a 2-dimensional array. @@ -26,6 +26,7 @@ of two integers, they specify the width and height. If one integer, then that integer is the width and the height is 3/4 of the width. If #f, the graph will be 800 by 600. @end defun + @noindent These graphing procedures should be called as arguments to @code{create-postscript-graph}. The order of these arguments is @@ -39,11 +40,12 @@ Pushes a rectangle for the whole encapsulated page onto the PostScript stack. This pushed rectangle is an implicit argument to @code{partition-page} or @code{setup-plot}. @end defun + @menu -* Column Ranges:: -* Drawing the Graph:: -* Graphics Context:: -* Rectangles:: +* Column Ranges:: +* Drawing the Graph:: +* Graphics Context:: +* Rectangles:: * Legending:: * Legacy Plotting:: * Example Graph:: @@ -65,21 +67,25 @@ Ranges can be given explicity or computed in PostScript by Returns the range of values in 2-dimensional @var{array} column @var{k}. @end defun + @defun pad-range range p Expands @var{range} by @var{p}/100 on each end. @end defun + @defun snap-range range Expands @var{range} to round number of ticks. @end defun + @defun combine-ranges range1 range2 @dots{} Returns the minimal range covering all @var{range1}, @var{range2}, ... @end defun + @defun setup-plot x-range y-range pagerect @@ -100,6 +106,7 @@ The region where data points will be plotted. The @var{pagerect} argument to @code{setup-plot}. Includes plotrect, legends, etc. @end table @end defun + @node Drawing the Graph, Graphics Context, Column Ranges, PostScript Graphing @subsubsection Drawing the Graph @@ -110,6 +117,7 @@ Plots points with x coordinate in @var{x-column} of @var{array} and y coordinate @var{array}. The symbol @var{proc3s} specifies the type of glyph or drawing style for presenting these coordinates. @end defun + @noindent The glyphs and drawing styles available are: @@ -156,6 +164,7 @@ Saves the current graphics state, executes @var{args}, then restores to saved graphics state. @end defun + @defun set-color color @var{color} should be a string naming a Resene color, a saturate color, or a @@ -165,6 +174,7 @@ number between 0 and 100. grey value between black (0) and white (100). @end defun + @defun set-font name fontheight @var{name} should be a (case-sensitive) string naming a PostScript font. @@ -173,6 +183,7 @@ grey value between black (0) and white (100). @code{set-font} Changes the current PostScript font to @var{name} with height equal to @var{fontheight}. The default font is Helvetica (12pt). @end defun + @noindent The base set of PostScript fonts is: @@ -194,6 +205,7 @@ as skinny as possible. Linewidth must be much smaller than glyphsize for readable glyphs. @end defun + @defun set-linedash j k Lines are drawn @var{j}-on @var{k}-off. @@ -205,11 +217,13 @@ Lines are drawn @var{j}-on @var{j}-off. Turns off dashing. @end defun + @defun set-glyphsize w Sets the (PostScript) variable glyphsize to @var{w}. The default glyphsize is 6. @end defun + @noindent The effects of @code{clip-to-rect} are also part of the graphic context. @@ -231,6 +245,7 @@ PostScript stack. This pushed rectangle is an implicit argument to @code{partition-page} or @code{setup-plot}. @end defun + @defun partition-page xparts yparts Pops the rectangle currently on top of the stack and pushes @var{xparts} * @var{yparts} @@ -238,6 +253,7 @@ sub-rectangles onto the stack in decreasing y and increasing x order. If you are drawing just one graph, then you don't need @code{partition-page}. @end defun + @defvar plotrect The rectangle where data points should be plotted. @var{plotrect} is set by @@ -255,17 +271,20 @@ The @var{pagerect} argument of the most recent call to fills @var{rect} with the current color. @end defun + @defun outline-rect rect Draws the perimiter of @var{rect} in the current color. @end defun + @defun clip-to-rect rect Modifies the current graphics-state so that nothing will be drawn outside of the rectangle @var{rect}. Use @code{in-graphic-context} to limit the extent of @code{clip-to-rect}. @end defun + @node Legending, Legacy Plotting, Rectangles, PostScript Graphing @subsubsection Legending @@ -277,6 +296,7 @@ the extent of @code{clip-to-rect}. Puts a @var{title} line and an optional @var{subtitle} line above the @code{graphrect}. @end defun + @defun title-bottom title subtitle @@ -284,6 +304,7 @@ Puts a @var{title} line and an optional @var{subtitle} line above the @code{grap Puts a @var{title} line and an optional @var{subtitle} line below the @code{graphrect}. @end defun + @defvar topedge @defvarx bottomedge @@ -298,6 +319,14 @@ These edge coordinates of @code{graphrect} are suitable for passing as the first argument to @code{rule-vertical}. @end defvar +@defun set-margin-templates left right + +The margin-templates are strings whose displayed width is used to +reserve space for the left and right side numerical legends. +The default values are "-.0123456789". +@end defun + + @defun rule-vertical x-coord text tick-width Draws a vertical ruler with X coordinate @var{x-coord} and labeled with string @@ -307,6 +336,7 @@ negative, then the ticks are -@var{tick-width} long on the left side of @var{x-c and numeric legends are on the right. @end defun + @defun rule-horizontal x-coord text tick-height Draws a horizontal ruler with X coordinate @var{x-coord} and labeled with @@ -316,27 +346,32 @@ is negative, then the ticks are -@var{tick-height} long on the left side of @var @var{text} and numeric legends are on the right. @end defun + @defun y-axis Draws the y-axis. @end defun + @defun x-axis Draws the x-axis. @end defun + @defun grid-verticals Draws vertical lines through @code{graphrect} at each tick on the vertical ruler. @end defun + @defun grid-horizontals Draws horizontal lines through @code{graphrect} at each tick on the horizontal ruler. @end defun + @node Legacy Plotting, Example Graph, Legending, PostScript Graphing @subsubsection Legacy Plotting @@ -361,6 +396,7 @@ supplied, it specifies the number of points to evaluate @var{func} at. coordinates. @var{x-label} and @var{y-label} are strings with which to label the x and y axes. @end defun + @node Example Graph, , Legacy Plotting, PostScript Graphing @subsubsection Example Graph @@ -418,7 +454,7 @@ disambiguate the scales. (define lines '()) (do ((line (read-line iprt) (read-line iprt))) ((eof-object? line) - (let ((nra (create-array (Ar64) + (let ((nra (make-array (A:floR64b) (length lines) (length (car lines))))) (do ((lns lines (cdr lns)) |