SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 1 Vol 2

DRAW

Name:
    DRAW
Type:
    Diagrammatic Graphics Command
Purpose:
    Draws a line segment.
Description:
    The two pairs of coordinates, (x1,y1) and (x2,y2), define the (x,y) values for the tail and the head (respectively) of the line segment.

    By default, the coordinates are in (0,100) screen units. You can also specify that the coordinates are in units of the most recent plot (referred to as data units). Screen or data units can be specified independently for the x and y coordinates.

    The arguments can be parameters (or numbers), variables, or a mix of parameters and variables. Any arguments that are variables must be the same length. If variable arguments are used, a line will be drawn for each row of the variables (arguments given as parameters will use the same value for all lines drawn).

    Coordinates can specify either absolute units or relative units. For example,

      DRAW 10 10 50 50

    will draw a line from (10,10) to (50,50) while

      DRAW RELATIVE 10 10 50 50

    will draw a line from (10,10) to (10+50,10+50), that is from (10,10) to (60,60).

    The DRAW command is most typically used to annotate a previously generated plot. For example, it may be used to draw reference lines.

Syntax 1:
    DRAW <RELATIVE> <x1> <y1> <x2> <y2>
    where <x1> is a number, parameter or variable that specifies the x coordinate for one end of the line segment;
                <y1> is a number, parameter or variable that specifies the y coordinate for one end of the line segment;
                <x2> is a number, parameter or variable that specifies the x coordinate for the other end of the line segment;
                and <y2> is a number, parameter or variable that specifies the y coordinate for the other end of the line segment.

    If all arguments are parameters, this syntax draws from (x1,y1) to (x2,y2) using screen coordinates. If the arguments are variables, one line will be drawn for each row of the variables. The arguments can be a mix of parameters and variables. However, all variables must be of the same length and any parameter arguments will use the same value for all lines drawn.

    Since this syntax uses screen units, all values should be in the 0 to 100 range.

    The keyword RELATIVE is optional. If omitted, the coordinates are in absolute units. If RELATIVE is included, the (<x2>,<y2>) coordinates are relative to (<x1>,<y1>).

Syntax 2:
    DRAWDATA <RELATIVE> <x1> <y1> <x2> <y2>
    where <x1> is a number, parameter or variable that specifies the x coordinate for one end of the line segment;
                <y1> is a number, parameter or variable that specifies the y coordinate for one end of the line segment;
                <x2> is a number, parameter or variable that specifies the x coordinate for the other end of the line segment;
                and <y2> is a number, parameter or variable that specifies the y coordinate for the other end of the line segment.

    This syntax is similar to Syntax 1. However, the coordinates are in data units rather than screen units.

    The keyword RELATIVE is optional. If omitted, the coordinates are in absolute units. If RELATIVE is included, the

Syntax 3:
    DRAWxxxx <RELATIVE> <x1> <y1> <x2> <y2>
    where <x1> is a number, parameter or variable that specifies the x coordinate for one end of the line segment;
                <y1> is a number, parameter or variable that specifies the y coordinate for one end of the line segment;
                <x2> is a number, parameter or variable that specifies the x coordinate for the other end of the line segment;
                and <y2> is a number, parameter or variable that specifies the y coordinate for the other end of the line segment.

    The "xxxx" string consists of exactly four characters where each character is either "S" to deonote screen units or "D" to denote data units. The first character specifies the units for <x1>, the second character specifies the units for <y1>, the third character specifies the units for <x2>, and the fourth character specifies the units for <y2>.

    This syntax is similar to Syntax 1. However, the coordinates can be drawn in a mix of screen and data units.

    The keyword RELATIVE is optional. If omitted, the coordinates are in absolute units. If RELATIVE is included, the

Syntax 4:
    DRAW <RELATIVE> <x1> <y1>
    where <x1> is a number or parameter in the decimal range 0 to 100 that specifies the x coordinate for one end of the line segment;
                and <y1> is a number or parameter in the decimal range 0 to 100 that specifies the y coordinate for one end of the line segment.

    This syntax draws from the current position (typically specified by a MOVE command) to (x1,y1).

    The keyword RELATIVE is optional. If omitted, the coordinates are in absolute units. If RELATIVE is included, the (<x1>,) coordinates are relative to the current position.

Syntax 5:
    DRAW <RELATIVE> <x1> <y1> <x2> <y2> ... <xn> <yn> etc.
    where <x1> is a number or parameter in the decimal range 0 to 100 that specifies the x coordinate for the first point of the line segment;
                <y1> is a number or parameter in the decimal range 0 to 100 that specifies the y coordinate for the first point of the line segment;
                <x2> is a number or parameter in the decimal range 0 to 100 that specifies the x coordinate for the second point of the line segment;
                <y2> is a number or parameter in the decimal range 0 to 100 that specifies the y coordinate for the second point of the line segment;
                <xn> is a number or parameter in the decimal range 0 to 100 that specifies the x coordinate for the nth point of the line segment;
                <yn> is a number or parameter in the decimal range 0 to 100 that specifies the y coordinate for the nth point of the line segment.

    This syntax draws from (x1,y1) to (x2,y2) to (x3,y3) and so on for each coordinate pair listed. The coordinates are given in screen units.

    The keyword RELATIVE is optional. If omitted, the coordinates are in absolute units. If RELATIVE is included, the current point is relative to the previous point (the initial point (<x1> and <y1>) is interpreted as absolute units).

Syntax 6:
    DRAWDATA <RELATIVE> <x1> <y1> <x2> <y2> ... <xn> <yn> etc.
    where <x1> is a number or parameter in the decimal range 0 to 100 that specifies the x coordinate for the first point of the line segment;
                <y1> is a number or parameter in the decimal range 0 to 100 that specifies the y coordinate for the first point of the line segment;
                <x2> is a number or parameter in the decimal range 0 to 100 that specifies the x coordinate for the second point of the line segment;
                <y2> is a number or parameter in the decimal range 0 to 100 that specifies the y coordinate for the second point of the line segment;
                <xn> is a number or parameter in the decimal range 0 to 100 that specifies the x coordinate for the nth point of the line segment;
                <yn> is a number or parameter in the decimal range 0 to 100 that specifies the y coordinate for the nth point of the line segment.

    This syntax draws from (x1,y1) to (x2,y2) to (x3,y3) and so on for each coordinate pair listed. The coordinates are given in data units.

    The keyword RELATIVE is optional. If omitted, the coordinates are in absolute units. If RELATIVE is included, the current point is relative to the previous point (the initial point (<x1> and <y1>) is interpreted as absolute units).

Examples:
    DRAW 30 30 60 60
    DRAW 50 20 50 90
    DRAWDATA 1 100 1 200
    DRAWDSDS 1 20 1 90
    DRAWDSDS X1 20 X1 90
Note:
    The line style (i.e., solid, dash), color, and thickness are controlled by the first entry of the LINE, LINE COLOR, and LINE THICKNESS commands. In particular, for SYNTAX 3 (where multiple lines are drawn) each of the line segments is drawn with the same attributes.
Note:
    Line segments defined by the SEGMENT COORDINATES command are drawn whenever a subsequent plot is generated. Line segments defined by the DRAW command are generated immediately.
Default:
    None
Synonyms:
    None
Related Commands: Applications:
    Plot Annotation
Implementation Date:
    Pre-1987
    1994/04: Support for data units
    2018/04: Support for variable arguments
Program 1:
     
    DRAW 10 10 20 20
    DRAW 60 20 80 30
    .
    THICKNESS 0.7
    DRAW 10 40 20 40
    THICKNESS 0.3
    .
    LINE DASH
    DRAW 10 60 20 60
    LINE SOLID
    .
    LINE COLOR G50
    DRAW 10 90 20 90
    LINE COLOR BLACK
    .
    THICKNESS 0.2
    DRAW 60 70 70 85 78 23 91 98
        
    plot generated by sample program
Program 2:
     
    SKIP 25
    READ SHEESLE2.DAT Y PROC PLANT SPEED SHIFT PROC
    .
    BAR ON
    BAR WIDTH 0.5
    LINES BLANK BLANK
    TITLE DEX PARETO PLOT
    TITLE OFFSET 2
    .
    MULTIPLOT 2 2
    MULTIPLOT CORNER COORDINATES 0 0 100 100
    MULTIPLOT SCALE FACTOR 2
    Y1LABEL MEAN
    LET A = MEAN Y
    BAR BASE A
    DEX MEAN PARETO PLOT Y PROC PLANT SPEED SHIFT
    LET NPTS = SIZE XPLOT
    LET XFIRST = 0.5
    LET XLAST = (NPTS-2) + 0.5
    LINE SOLID
    DRAWDATA  XFIRST A XLAST A
    LINE BLANK
    .
    Y1LABEL MEDIAN
    LET A = MEDIAN Y
    BAR BASE A
    DEX MEDIAN PARETO PLOT Y PROC PLANT SPEED SHIFT
    LINE SOLID
    DRAWDATA  XFIRST A XLAST A
    LINE BLANK
    .
    YLIMITS
    Y1LABEL STANDARD DEVIATION
    LET A = STANDARD DEVIATION Y
    BAR BASE A
    DEX SD PARETO PLOT Y PROC PLANT SPEED SHIFT
    LINE SOLID
    DRAWDATA  XFIRST A XLAST A
    LINE BLANK
    .
    Y1LABEL RANGE
    LET A = RANGE Y
    BAR BASE A
    DEX RANGE PARETO PLOT Y PROC PLANT SPEED SHIFT
    LINE SOLID
    DRAWDATA  XFIRST A XLAST A
    LINE BLANK
    END OF MULTIPLOT
        
    plot generated by sample program

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 04/19/2018
Last updated: 04/19/2018

Please email comments on this WWW page to alan.heckert@nist.gov.