DPUSER - The Next Generation: Plotting
Author: Thomas Ott

# Plotting

DPUSER incorporates the complete PGPLOT package. All modules of this package are realized as procedures (see list of available PGPLOT procedures). The PGPLOT documentation provided here is a verbatim copy of the online documentation of PGPLOT.
DPUSER uses a global variable `plotdevice` to control graphics output. Available devices depend on your installation of PGPLOT. The default graphics device on UNIX workstations is `"/xserve"`. This can be changed by assigning a new string value to the variable. A typical use of PGPLOT looks like this:

> `plotdevice = "/tmp/test.eps/ps" // Write ps output to /tmp/test.eps`
> `x = [-3600:3600]/10 // create x-axes`
> `y = sin(x, /deg) // create sine function (y-axes)`
> `pgopen plotdevice // Start plotting`
> `pgenv -360, 360, -1, 1, 0, 0 // draw labeled frame`
> `pglab "angle", "sine", "test plot" // annotate plot`
> `pgline 7201, x, y // draw the sine function`
> `pgend // end plotting`
> `plotdevice = "/xserve" // reset graph output to X`

Since plotting a x-y graph is, amongs others, a very common task, DPUSER provides several convenience procedures to do things like this: plot, contour, surface, and shade. The above example using the plot command looks like this:

> `plotdevice = "/tmp/test.eps/ps" // Write ps output to /tmp/test.eps`
> `x = [-3600:3600]/10 // create x-axes`
> `y = sin(x, /deg) // create sine function (y-axes)`
> `plot x, y, xtitle="angle", ytitle="sine", title="test plot"`
> `// do the plot`
> `plotdevice = "/xserve" // reset graph output to X`

This can be done even shorter:

> `plot sin([-3600:3600]/10)`

will plot a sine function without any annotation to the current plot device, overriding any previous plot. A very simple contour plot can also be done:

> `contour gauss(129,129,30,50,30), [1:9]*10`

will do a contour plot of an elliptical gaussian with contour levels 10%, 20%, ..., 90%.