Class postscript

Use this class to make a postscript drawing surface.

Initialize with following parameters:
titledefault: 'default.eps' Name of the output file.
dimensionsdefault: ['3in','2in'] Size of the drawing surface.
fontdefault: 'Helvetica' Default font for text.
verbosedefault: False Whether to add more info into output file.
scriptdefault: __file__ Name of the file calling into zplot; recorded in header.

postscript.render()

Use this routine to print out all the postscript commands you've been queueing up to a file or 'stdout' (default).

postscript.line()

Use this to draw a line on the canvas.

coorddefault: [[0,0],[0,0]] Coordinates of the line. A list of [x,y] pairs. Can
be as long as you like (not just two points).
linecolordefault: 'black' Color of the line.
linewidthdefault: 1 Width of the line.
linejoindefault: 0 For turns in the line, how turn should be rounded.
Options include 0->'miter', 1->'round', 2->'bevel'
Default is miter
linecapdefault: 0 Shape used at end of line (0->'butt', 1->'round', 2->'square')
linedashdefault: 0 Dash pattern of the line. '0' means no dashes.
Otherwise, a list describing the on/off pattern
of the dashes, e.g., [2,2] means 2 on, 2 off, repeating.
closepathdefault: False Can use this to close the path (and perhaps fill it).
arrowdefault: False Turn an arrow at last segment on or off.
arrowheadlengthdefault: 4 Length of arrow head.
arrowheadwidthdefault: 3 Width of arrow head.
arrowlinecolordefault: 'black' Color of arrow head line.
arrowlinewidthdefault: 0.5 Width of line that makes arrow head.
arrowfilldefault: True Fill arrow head with solid color?
arrowfillcolordefault: 'black' Color to fill arrow head with.
arrowstyledefault: 'normal' Style to use. 'normal' is one option. There are no others.

postscript.text()

Use this routine to place text on the canvas. Most options are obvious: the expected coordinate pair, color, text, font, size - the size of the font, rotation - which way the text should be rotated, but the anchor can be a bit confusing. Basically, the anchor determines where, relative to the coordinate pair (x,y), the text should be placed. Simple anchoring includes left (l), center (c), or right (r), which determines whether the text starts at the x position specified (left), ends at x (right), or is centered on the x (center). Adding a second anchor (xanchor,yanchor) specifies a y position anchoring as well. The three options there are low (l), which is the default if none is specified, high (h), and middle (m), again all determining the placement of the text relative to the y coordinate specified.

coorddefault: [0,0] Coordinates for text on the canvas.
textdefault: 'text' Actual text to place on the canvas.
fontdefault: 'default' Typeface to use.
colordefault: 'black' Color of letters.
sizedefault: 10 Font size.
anchordefault: 'c' Anchor: can either just specify left/right
(e.g., 'c' for center, 'l' for left justify, 'r' for right)
or can also specify vertical alignment (e.g., 'l,h' for left justify and high justify,
'r,c' for right and center, 'l,l' for left and low).
rotatedefault: 0 Rotate text by this many degrees.
bgcolordefault: '' Background color behind text? Empty means no.
bgborderdefault: 1 Border (black) around background color?

postscript.box()

Makes a box at coords specifying the bottom-left and upper-right corners. Can change the width of the surrounding line (linewidth=0 removes it). Can fill with solid or pattern. When filling with non-solid pattern, can add a background color so as not to be see-through.

coorddefault: [[0,0],[0,0]] Coordinates of box, from [x1,y1] to [x2,y2].
linecolordefault: 'black' Color of lines that draws box.
linewidthdefault: 1 Width of those lines. 0 means unlined box.
linedashdefault: 0 Dash pattern in lines around box?
linecapdefault: 0 How should corners be done? 0 is default; 1->'round', 2->'bevel'.
filldefault: False Should box be filled? If so, specify here.
fillcolordefault: 'black' Color of the fill pattern.
fillstyledefault: 'solid' Type of fill pattern. Right now, all are 'solid'.
fillsizedefault: 3 Details of fill pattern includes size of each marker in pattern.
fillskipdefault: 4 Also includes spacing between each marker in pattern.
rotatedefault: 0 Rotate the box by this many degrees.
bgcolordefault: '' Put a background color behind the box. Useful when pattern has
see-through parts in it.

postscript.arc()

Can make circles, or partial circles (arcs), with this.

coorddefault: [] Coordinates of arc center [x, y].
angledefault: [0.0,360.0] What angle to draw arc (from X degrees to Y degrees).
radiusdefault: 1 Radius of arc.
linecolordefault: 'black' Line color of arc.
linewidthdefault: 1 Width of line of arc.
linedashdefault: 0 Dash pattern for arc line.

postscript.circle()

Can just make circles with this. Filled or not.

coorddefault: [0,0] Coordinates of center of circle in [x,y].
radiusdefault: 1 Radius of circle.
scaledefault: [1,1] Scale in x direction and y direction, to make
an ellipse, for example.
linecolordefault: 'black' Color of lines of circle.
linewidthdefault: 1 Width of lines of circle.
linedashdefault: 0 Whether line is dashed or not.
filldefault: False Fill circle with colored pattern?
fillcolordefault: 'black' Which color?
fillstyledefault: 'solid' Which pattern?
fillsizedefault: 3 Details of pattern: size of each marker.
fillskipdefault: 4 Details of pattern: space between each marker.
bgcolordefault: '' Background color behind circle, useful if fill pattern
has some holes in it.

postscript.polygon()

Use this method to make an arbitrary polygon, by passing in its coordinates. All the usual arguments are specified.

coorddefault: [] The list of [x,y] pairs that form the coordinates.
linecolordefault: 'black' The color of the surrounding line (if width > 0).
linewidthdefault: 1 The width of the line (0 for no line).
linecapdefault: 0 The linecap.
linedashdefault: 0 The line dash pattern.
filldefault: False Fill the polygon?
fillcolordefault: 'black' What color to fill it?
fillstyledefault: 'solid' What style to fill it with?
fillsizedefault: 3 The fill size...
fillskipdefault: 4 ...and the skip.
bgcolordefault: '' A background color if there is no fill; useful
behind a pattern.