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 (float *xray, 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 (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 fter 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 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).

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 (float *x1ray, float *y1ray, int n1, float *x2ray, 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 (float *xray, float *yray, float *e1ray, 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 Plotting Vector Fields

F I E L D

The routine FIELD plots a vector field.

The call is: CALL FIELD (X1RAY, Y1RAY, X2RAY, Y2RAY, N, IVEC) level 2, 3
or:void field (float *x1ray, float *y1ray, float *x2ray, 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 a four digit number that specifies the vector (see VECTOR).


Next | Previous | Contents