Drawing the Graph

PLplot can draw graphs consisting of points with optional error bars, line segments or histograms. Functions which perform each of these actions may be called after setting up the plotting environment using plenv. All of the following functions draw within the box defined by plenv, and any lines crossing the boundary are clipped. Functions are also provided for drawing surface and contour representations of multi-dimensional functions. See Chapter 3, Advanced Use of PLplot for discussion of finer control of plot generation.

Drawing Points

plstring, plpoin, and plsym plot n points (x[i], y[i]) using the specified symbol. The routines differ only in how the plotted symbol is specified. plstring is now the preferred way of drawing points for unicode-aware devices because it gives users full access via a UTF-8 string to any unicode glyph they prefer for the symbol that is is available via system fonts. plpoin and plsym are limited to Hershey glyphs and are therefore more suitable for device drivers that only use Hershey fonts. For both of these functions the Hershey glyph is indicated by a code value. plpoin uses an extended ASCII index of Hershey glyphs for that code value, with the printable ASCII codes mapping to the respective characters in the current Hershey font, and the codes from 0–31 mapping to various useful Hershey glyphs for symbols. In plsym however, the code is a Hershey font code number. Standard examples 04, 21, and 26, demonstrate use of plstring while standard example 06 demonstrates all the Hershey symbols available with plpoin and standard example 07 demonstrates all the Hershey symbols available with plsym.

Drawing Lines or Curves

PLplot provides two functions for drawing line graphs. All lines are drawn in the currently selected color, style and width. See the section called “Setting Line Attributes” for information about changing these parameters.

plline draws a line or curve. The curve consists of n-1 line segments joining the n points in the input arrays. For single line segments, pljoin is used to join two points.

Writing Text on a Graph

The plptex API allows UTF-* text to be written anywhere within the limits set by plenv with justification and text angle set by the user.

Area Fills

Area fills are done in the currently selected color, line style, line width and pattern style.

plfill fills a polygon. The polygon consists of n vertices which define the polygon.

More Complex Graphs

Functions plbin and plhist are provided for drawing histograms, and functions plerrx and plerry draw error bars about specified points. There are lots more too (see Chapter 17, The Common API for PLplot).