Annotated List of Routines

Version 5.2

Many of the routines that set the values of parameters used by PGPLOT have corresponding inquiry routines that can be used to determine the current parameter values. Most of these routines have names starting PGQ... and are indicated in italics.

Opening, Closing, and Selecting Devices

Use PGOPEN to open a graphical device or file and select it for PGPLOT output, PGCLOS to close the device when graphical output is completed, and PGSLCT to switch subsequent output to a different open device. PGBEG is an alternative to PGOPEN, retained for compatibility with existing programs. PGEND can be used to close all open devices. The following routines can be used to determine what types of graphics device are available - the list of types is installation-dependent. After a graphics device has been opened, the following routines may be used to determine some of its device-dependent characteristics.

Controlling the View Surface

Use PGPAGE to start a new page, or PGERAS to clear the screen without starting a new page. On interactive devices, PGPLOT prompts the user before starting a new page unless told not to via PGASK. The size of the view surface is device-dependent and is established when the graphics device is opened. Use PGQVSZ if you need to know the absolute size of the view surface. On some devices, it can be changed by calling PGPAP before starting a new page with PGPAGE. On some devices, the size can be changed (e.g., by a workstation window manager) outside PGPLOT, and PGPLOT detects the change when PGPAGE is used. PGPLOT can divide the view surface into two or more panels; to request this, call PGSUBP after opening the device or before starting a new page. When the view surface is divided into panels, PGPAGE advances to the next panel, only clearing the screen or starting a new page after all the panels have been filled. It is also possible to move to a specific panel by calling PGPANL. To improve efficiency by buffering graphical output, group a sequence of PGPLOT routines between PGBBUF and PGEBUF calls. To force a screen update, call PGUPDT.

Windows and Viewports

Specify the viewport to indicate where on the device's view surface you want the graph to appear. Specify the window to define the range of your world-coordinate space that will be visible in the viewport. Normally all PGPLOT primitives except text are ``clipped'' at the edge of the viewport; use PGSCLP to disable or re-enable clipping.



Straight lines and curves made up of straight-line segments can be specified either segment by segment (PGMOVE, PGDRAW) or by a list of points to be joined together (PGLINE).

Polygons and Filled Areas

Closed polygons, circles, and rectangles canbe outlined, filled with solid color, or shaded using hatching, depending on the current fill-area attributes.

Graph Markers

Use PGPT1 to mark a single point, PGPT to mark several points with the same symbol, or PGPNTS to mark several points with different symbols.


The basic routine for drawing text is PGPTXT. PGTEXT provides a simplified interface for the commonest case. In order to correctly position text on a graph, it may be necessary to determine the space occupied by a text string without actually drawing it.


An arrow is made up of a line (for the shaft) and a polygon (for the head), but can be regarded as a separate primitive.



Line Attributes

Text and Marker Attributes

Fill-Area Attributes

Arrow Attributes

Saving and Restoring Attributes

Axes, Boxes, and Labels

To label a graph with axes or a box around the viewport, use PGBOX (or PGTBOX if one or both coordinates are to be treated as a time or angle). More complete control over axes is possible with PGAXIS, including drawing axes that are not parallel to the edges of the viewport. If you need complete control over how an axis is labeled, e.g., for non-linear or curved axes, draw the axis with line-drawing routines and then label it with PGTICK. To place labels around the edges of the viewport, use PGLAB or PGMTXT.

XY Plots

Error Bars

Curves Defined by Functions


Contour Maps


Vector Plots

Interactive Graphics

Miscellaneous Routines

Tim Pearson, California Institute of Technology, tjp·
Copyright © 1997 California Institute of Technology