plot_to_ps


plot_to_ps, a FORTRAN90 code which reads a text file of plot commands and creates a PostScript file.

I often use this utility to make simple graphics illustrations.

Commands:

ARC X Y R ANGLE1 ANGLE2
draw the circular arc from ANGLE1 to ANGLE2, for a circle of radius R and center (X,Y).
ARROW X1 Y1 X2 Y2
draw an arrow from (X1,Y1) to (X2,Y2).
CIRCLE X Y R
draw a circle of radius R and center (X,Y).
CIRCLE_FILL X Y R
draw a circle of radius R and center (X,Y) and fill it with the current fill color.
DEBUG
switch the debugging state.
DRAWTO X Y
draw a line from the current point to (X,Y).
ELLIPSE X Y R1 R2 ANGLE
draw an ellipse centered at (X,Y) with axes lengths R1 and R2, an an angle ANGLE.
ELLIPSE_FILL X Y R1 R2 ANGLE
draw an ellipse centered at (X,Y) with axes lengths R1 and R2, an an angle ANGLE, and fill it with the current color.
ENDFILE
indicate the end of the file.
ENDPAGE
indicate the end of this "page" or image.
FILE NAME
specifies the name of the output file.
FILL_GRAY GRAY
sets the fill color to the given shade of gray.
FILL_RGB R G B
sets the fill color to the given RGB color.
FONT_SIZE H
sets the font size to the given height.
GRID X1 Y1 X2 Y2 N1 N2
draws an N1 by N2 grid in the box from (X1,Y1) to (X2,Y2).
HIST_FAT W
sets the width of histogram bars to W.
HISTOGRAM (followed by X,Y pairs, then END)
processes histogram data.
LABEL text
prints the text at the current position and current font size and current line color.
LABEL_SLANT ANGLE
sets a slant angle for a label.
LINE X1 Y1 X2 Y2
draws a line from (X1,Y1) to (X2,Y2).
LINE_GRAY GRAY
sets the line color to the given gray shade.
LINE_RGB R G B
sets the line color to the given RGB color.
LINE_WIDTH N
sets the line width. 1 is the finest.
LINETO X Y
draws a line from the current point to (X,Y). Same as DRAWTO.
MOVETO X Y
moves to (X,Y) without drawing.
PAGE
begins a new page or image.
POINT X Y
draws a point at (X,Y).
POINT_LIST (followed by X,Y pairs, then END)
draws a point at each of the (X,Y) pairs that follow.
POLYGON (followed by X,Y pairs, then END)
draws a outlined polygon by connecting the (X,Y) pairs that follow.
POLYGON_FILL (followed by X,Y pairs, then END)
draws a filled polygon by connecting the (X,Y) pairs that follow.
RADIUS X Y R ANGLE
for the circle of radius R and center (X,Y), draw the radial line at angle ANGLE.
SECTOR X Y R ANGLE1 ANGLE2
draws the sector of a circle centered at (X,Y) with radius R, from ANGLE1 to ANGLE2.
SECTOR_FILL X Y R ANGLE1 ANGLE2
draws the sector of a circle centered at (X,Y) with radius R, from ANGLE1 to ANGLE2, and fills it with current color.
SPACE X1 Y1 X2 Y2
defines the coordinate space to use in the current page.
SQUARE X Y R
draws a square centered at (X,Y) with radius R.
SQUARE_FILL X Y R
draws a square centered at (X,Y) with radius R and fills it.
STAR X Y R
draws a star centered at (X,Y) with radius R.
STAR_CIRCLE X Y R
draws open circles at the ten vertices of a star centered at (X,Y) with radius R.
STAR_DISK X Y R
draws filled disks at the ten vertices of a star centered at (X,Y) with radius R.
TRIANGLE X1 Y1 X2 Y2 X3 Y3
draws a triangle with the given vertices.
TRIANGLE_FILL X1 Y1 X2 Y2 X3 Y3
draws a triangle with the given vertices, and fills it with the current color.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

plot_to_ps is available in a FORTRAN90 version

Related Data and Software:

plot_to_ps_test

PS_WRITE, a FORTRAN90 code which implements PostScript graphics routines that is used by PLOT_TO_PS.

TRIANGULATION_PLOT, a FORTRAN90 code which makes a PostScript image of a triangulation of points.

VORONOI_PLOT, a FORTRAN90 code which plots the Voronoi neighborhoods of points in the 2D unit square, using L1, L2 or LInfinity norms;

Reference:

  1. Henry McGilton, Mary Campione,
    PostScript by Example,
    Addison-Wesley,
    ISBN: 0-201-63228-4

Source Code:


Last revised on 06 August 2020.