Chapter 5: Plotting Curves

This chapter describes how to plot curves with lines and symbols. Several curves can be plotted in one axis system and can be differentiated by colour, line style and pattern. Curve attributes can be plotted in a legend.

5.1 Plotting Curves

C U R V E

CURVE connects data points with lines or plots them with symbols.

The call is: CALL CURVE (XRAY, YRAY, N) level 2, 3
or:void curve (const float *xray, const float *yray, int n);

XRAY, YRAY are arrays that contain X- and Y-coordinates. For a polar scaling, XRAY must hold the radial values and YRAY the angular values expressed in radians.
N is the number of data points.

Additional notes:

5.2 Plotting Legends

To differentiate multiple curves in an axis system, legends with text can be plotted. DISLIN can store up to 30 curve attributes such as symbols, thicknesses, line styles and colours and these can be incorporated in a legend.

Legends are created with the following steps:

  1. define a character variable used to store the lines of text in the legend
  2. initialize the legend
  3. define the lines of text
  4. plot the legend.
The corresponding routines are:

L E G I N I

LEGINI initializes a legend.

The call is: CALL LEGINI (CBUF, NLIN, NMAXLN) level 1, 2, 3
or:void legini (char *cbuf, int nlin, int nmaxln);

CBUF is a character variable used to store the lines of text in the legend. The variable must be defined by the user to have at least NLIN * NMAXLN characters.
NLIN is the number of text lines in the legend.
NMAXLN is the number of characters in the longest line of text.

L E G L I N

LEGLIN stores lines of text for the legend.

The call is: CALL LEGLIN (CBUF, CSTR, ILIN) level 1, 2, 3
or:void leglin (char *cbuf, char *cstr, int ilin);

CBUF see LEGINI.
CSTR is a character string that contains a line of text for the legend.
ILIN is the number of the legend line between 1 and NLIN.

L E G E N D

LEGEND plots legends.

The call is: CALL LEGEND (CBUF, NCOR) level 2, 3
or:void legend (const char *cbuf, int ncor);

CBUF see LEGINI.
NCOR indicates the position of the legend:
= 1 is the lower left corner of the page.
= 2 is the lower right corner of the page.
= 3 is the upper right corner of the page.
= 4 is the upper left corner of the page.
= 5 is the lower left corner of the axis system.
= 6 is the lower right corner of the axis system.
= 7 is the upper right corner of the axis system.
= 8 is the upper left corner of the axis system.

The following routines change the position and appearance of a legend. They must be called after LEGINI except for the routines FRAME and LINESP.

L E G P A T

The routine LEGPAT stores curve attributes plotted in legends. Normally, this is done automatically by routines such as CURVE and BARS.

The call is: CALL LEGPAT (ITYP, ITHK, ISYM, ICLR, IPAT, ILIN) level 1, 2, 3
or:void legpat (int ityp, int ithk, int isym, int iclr, long ipat, int ilin);

ITYP is the line style between -1 and 7 (see LINTYP). IF ITYP = -1, no line will be plotted in the legend line.
ITHK defines the thickness of lines (> 0).
ISYM is the symbol number between -1 and 21. If ISYM = -1, no symbol will be plotted in the legend line.
ICLR is the colour value. If ICLR = -1, the current colour will be used.
PAT is the shading pattern (see SHDPAT). If IPAT = -1, no pattern will be plotted in the legend line.
ILIN is the legend line between 1 and NLIN.

Additional notes:

L E G T Y P

Legend entries can be plotted in vertical or horizontal direction depending on the option in LEGTYP. The routine must be called before LEGINI.

The call is: CALL LEGTYP (COPT) level 1, 2, 3
or:void legtyp (const char *copt);

COPT is a character string that can have the values 'VERT' and 'HORI'.
Default: COPT = 'VERT'.

L E G O P T

The routine LEGOPT modifies the appearance of legends.

The call is: CALL LEGOPT (XF1, XF2, XF3) level 1, 2, 3
or:void legopt (float xf1, float xf2, float xf3);

XF1 is a multiplier for the length of the pattern field. The length is XF1 * NH, where NH is the current character height. If XF1 = 0., the pattern field will be suppressed.
XF2 is a multiplier for the distance between legend frames and text. The distance is XF2 * NH * XSPC, where XSPC is the spacing between legend lines (see LINESP).
XF3 is a multiplier for the spacing between multiple text lines. The space is XF3 * NH * XLINSP.
Default: (4.0, 0.5, 1.0).

L E G V A L

The routine LEGVAL modifies the appearance of legends.

The call is: CALL LEGVAL (X, COPT) level 1, 2, 3
or:void legval (float x, const char *copt);

COPT is a character string that can have the value 'SYMBOL'. For COPT = 'SYMBOL', the parameter X defines the size of symbols used in legends. The size is X * NH, where NH is the current character height.
Default: (0.8, 'SYMBOL').

L E G S E L

The routine LEGSEL selects legend lines that are plotted by LEGEND.

The call is: CALL LEGSEL (IRAY, N) level 1, 2, 3
or:void legsel (const int *iray, int n);

IRAY is an is an integer array that contains legend lines between 1 and NLIN, where NLIN is the parameter in LEGINI.
N is the number of elements in IRAY. If N = -1, all legend lines are plotted.
Default: N = -1

5.3 Plotting Shaded Areas between Curves

S H D C R V

SHDCRV plots a shaded area between two curves.

The call is: CALL SHDCRV (X1RAY, Y1RAY, N1, X2RAY, Y2RAY, N2) level 2, 3
or:void shdcrv (const float *x1ray, const float *y1ray, int n1, const float *x2ray, const float *y2ray, int n2);

X1RAY, Y1RAY are arrays with the X- and Y-coordinates of the first curve. Values are not changed by SHDCRV.
N1 is the number of points in the first curve.
X2RAY, Y2RAY are arrays with the X- and Y-coordinates of the second curve. Values are not changed by SHDCRV.
N2 is the number of points in the second curve.

Additional notes:

5.4 Plotting Error Bars

E R R B A R

The routine ERRBAR plots error bars.

The call is: CALL ERRBAR (XRAY, YRAY, E1RAY, E2RAY, N) level 2, 3
or:void errbar (const float *xray, const float *yray, const float *e1ray, const float *e2ray, int n);

XRAY, YRAY are arrays that contain the X- and Y-coordinates.
E1RAY, E2RAY are arrays that contain the errors. Lines will be drawn from YRAY - E1RAY to YRAY + E2RAY.
N is the number of data points.

Additional notes:

5.5 Vector Fields

F I E L D

The routine FIELD plots a vector field where the start and end points of the vectors are already calculated. The vectors are displayed as arrows.

The call is: CALL FIELD (X1RAY, Y1RAY, X2RAY, Y2RAY, N, IVEC) level 2, 3
or:void field (const float *x1ray, const float *y1ray, const float *x2ray, const float *y2ray, int n, int ivec);

X1RAY, Y1RAY are arrays that contain the X- and Y-coordinates of the start points.
X2RAY, Y2RAY are arrays that contain the X- and Y-coordinates of the end points.
N is the number of vectors.
IVEC is an integer that specifies the form of the arrows (see VECTOR).

V E C F L D

The routine VECFLD plots a vector field of given vectors and positions. The vectors are displayed as arrows.

The call is: CALL VECFLD (XVRAY, YVRAY, XPRAY, YPRAY, N, IVEC) level 2, 3
or:void vecfld (const float *xvray, const float *yvray, const float *xpray, const float *ypray, int n, int ivec);

XVRAY, YVRAY are arrays that contain the X- and Y-coordinates of the vectors.
X2RAY, Y2RAY are arrays that contain the X- and Y-coordinates of the start points.
N is the number of vectors.
IVEC is an integer that specifies the form of the arrows (see VECTOR).

Additional notes:

V E C M A T

The routine VECMAT plots a vector field on a regular grid.

The call is: CALL VECMAT (XVMAT, YVMAT, NX, NY, XPRAY, YPRAY, IVEC) level 2, 3
or: void vecmat (const float *xvmat, const float *yvmat, int nx, int ny, const float *xpray, const float *ypray, int ivec);

XVMAT, YVMAT are arrays of the dimension (NX, NY) that contain the X- and Y-coordinates of the vectors.
NX, NY define the dimension of XVMAT and YVMAT.
XPRAY, YPRAY are arrays of the dimensions NX und NY that define the grid in the X/Y plane.
IVEC is an integer that specifies the form of the arrows (see VECTOR).

Additional note:

S T R E A M

The routine STREAM plots streamlines of a vector field on a regular grid.

The call is: CALL STREAM (XVMAT, YVMAT, NX, NY, XPRAY, YPRAY, XSRAY, YSRAY, N) level 2, 3
or: void stream (const float *xvmat, const float *yvmat, int nx, int ny, const float *xpray, const float *ypray, const float *xsray, const float *ysray, int n);

XVMAT, YVMAT are arrays of the dimension (NX, NY) that contain the X- and Y-coordinates of the vectors.
NX, NY define the dimension of XVMAT and YVMAT.
XPRAY, YPRAY are arrays of the dimensions NX und NY that define the grid in the X/Y plane.
XSRAY, YSRAY are arrays of the dimension N that contain starting points of the streamlines. If no starting points are given, evenly-spaced streamlines are automatically plotted by DISLIN. The evenly-spaced streamlines algorithm is based on an idea by Bruno Jobard and Wilfrid Lefer [JOBA97].
N is the number of starting points (N >= 0).

Additional notes:

S T M P T S

The routine STMPTS returns a calculated streamline of a vector field on a regular grid.

The call is: CALL STMPTS (XVMAT, YVMAT, NX, NY, XPRAY, YPRAY, X0, Y0, XRAY, YRAY, NMAX, N) level 1, 2, 3
or: void stmpts (const float *xvmat, const float *yvmat, int nx, int ny, const float *xpray, const float *ypray, float x0, float y0, float *xray, float *yray, int n);

XVMAT, YVMAT are arrays of the dimension (NX, NY) that contain the X- and Y-coordinates of the vectors.
NX, NY define the dimension of XVMAT and YVMAT.
XPRAY, YPRAY are arrays of the dimensions NX and NY that define the grid in the X/Y plane.
X0, Y0 define the starting point of the streamline.
XRAY, YRAY are arrays of the dimension NMAX that will contain the calculated streamline.
NMAX is the dimension of XRAY and YRAY.
N is the returned number of points in XRAY and YRAY.

Additional note:

S T M T R I

The routine STMTRI plots streamlines of a vector field on a triangular grid.

The call is: CALL STMTRI (XVRAY, YVRAY, XPRAY, YPRAY, N, I1RAY, I2RAY, I3RAY, NTRI, XSRAY, YSRAY, NRAY) level 2, 3
or: void stmtri (const float *xvray, const float *yvray, const float *xpray, const float *ypray, int n, const int *i1ray, const int *i2ray, const int *i3ray, in ntri, const float *xsray, const float *ysray, int nray);

XVRAY, YVRAY are arrays of the dimension N that contain the X- and Y-coordinates of the vectors.
XPRAY, YPRAY are arrays of the dimension N that contain the positions of the vectors.
N is the number of vectors.
I1RAY, I2RAY, I3RAY is a triangulation of the points in XPRAY and YPRAY.
NTRI is the number of triangles in I1RAY, I2RAY and I3RAY.
XSRAY, YSRAY are arrays of the dimension NRAY that contain starting points of the streamlines. If no starting points are given, evenly-spaced streamlines are automatically plotted by DISLIN.
NRAY is the number of starting points (NRAY >= 0).

L I C P T S

The routine LICPTS calculates a Line Integral Convolution (LIC) image of a vector field.

The call is: CALL LICPTS (XVMAT, YVMAT, NX, NY, ITMAT, IWMAT, WMAT) level 1, 2, 3
or: void licpts (const float *xvmat, const float *yvmat, int nx, int ny, const int *itmat, int *iwmat, float *wmat);

XVMAT, YVMAT are arrays of the dimension (NX, NY) that contain the X- and Y-coordinates of the vectors.
NX, NY define the dimension of XVMAT, YVMAT, ITMAT, IWMAT and WMAT.
ITMAT is a texture array of the dimension (NX, NY) that is used for the LIC algorithm. A random texture can be calculated with the routine TXTURE.
IWMAT is a working array of the dimension (NX, NY). After the call to LICPTS, IWMAT contains the number of hits for image pixels covered by streamlines.
WMAT is an output array of the dimension (NX, NY) that contains the calculated LIC image. WMAT contains floating point numbers between 0 and 255.

Additional notes:

T X T U R E

The routine TXTURE generates a random texture array that can be passed to the routine LICPTS.

The call is: CALL TXTURE (ITMAT, NX, NY) level 1, 2, 3
or: void txture (int *itmat, int nx, int ny);

ITMAT is a returned texture array of the dimension (NX, NY). ITMAT contains random numbers in the range 0 to 255.
NX, NY define the dimension of ITMAT.

Additional note:


Next | Previous | Contents