EMBED
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

EMBED

Name:
    EMBED
Type:
    Plot Control Command
Purpose:
    Provides an alternative method for generating multiplot plots per page.
Description:
    The MULTIPLOT command is the standard command used to generate multiplot plots per page. It works by defining a grid of equal sized sub-plot areas. That is, MULTIPLOT 4 3 will define a grid of 4 rows and 3 columns (for a total of 12) of plots. Each subsequent plot is generated in the next grid location.

    The EMBED command provides an alternative method for generating multiplot plots per page. It works as follows:

    1. Enter the EMBED ON command.

    2. The first plot generated after the EMBED ON command defines a base coordinates system. In some cases, this first plot will essentially be a dummy plot. In other cases, it will generate a background plot.

    3. For subsequent plots, enter the command

        EMBED CORNER COORDINATES <xlow> <ylow> <xhigh> <yhigh>

      The parameters for this command are given in units of the base coordinate system (i.e., the coordinates defined by the first plot after the EMBED ON command). The coordinates given on the EMBED CORNER COORDINATES command now define a sub-plot area where subsequent plots are drawn.

      Note that the EMBED CORNER COORDINATES defines where the subsequent plot will be drawn. That subsequent plot will have it's own coordinate system that is independent of the base coordinate system.

      Typically, you will have a separate EMBED CORNER COORDINATES command for each subsequent plot. However, you can in fact overlay multiple plots in a single sub-plot area if needed.

    4. Enter EMBED OFF to end the EMBED sequence.

    Although EMBED is similar to MULTIPLOT, there are several important distinctions.

    1. The EMBED command allows you to create a "background" plot that covers the full plot region.

    2. The EMBED command does not require equal sized sub-plot areas. You can define an arbitrary sub-plot area. The sub-plot area is still limited to rectangular regions and it must lie within the base coordinate system defined by the first plot.

    The EMBED command has several typical uses.

    1. It can be used to arbitrarily position sub-plots on the page.

    2. It can be used to create summary plots for a sub-plot region.
Syntax 1:
    EMBED <ON/OFF>
    where ON starts an embed sequence and OFF ends an embed sequence.
Syntax 2:
    EMBED CORNER COORDINATES <x1> <y1> <x2> <y2>
    where <x1> is a decimal number or parameter that specifies the horizontal position of the lower left corner;
                <y1> is a decimal number or parameter that specifies the vertical position of the lower left corner;
                <x2> is a decimal number or parameter that specifies the horizontal position of the upper right corner;
                <y2> is a decimal number or parameter that specifies the vertical position of the upper right corner.

    The values of <x1>, <y1>, <x2>, and <y2> are given in units of the first plot generated after the EMBED ON command (the base coordinate system). If a subsequent plot specifies embed corner coordinates that are outside the range of the base coordinate system, an error will be reported and the plot will not be generated.

    Note that the corner coordinates given here simply position the plot area. This is independent of the coordinate system for the subsequent plot.

Examples:
    EMBED ON
    PLOT Y X
    EMBED CORNER COORDINATES 200 10 350 45
    HISTOGRAM Z
    EMBED OFF
Note:
    The MULTIPLOT SCALE command will be used to scale the size of hardware text characters when the EMBED sequence is active. The scaling will not be applied to the first plot after the EMBED ON command since this is a full size plot.
Note:
    The MULTIPLOT and EMBED options cannot be used together. When a plot is generated, if both MULTIPLOT and EMBED are active, an error will be reported and no plot will be generated.
Note:
    There is no restriction on the type of plot that can be used in conjunction with the EMBED command.
Default:
    None
Synonyms:
    None
Related Commands: Applications:
    Exploratory Data Analysis
Reference:
    Grolemund and Wickham (2015), "Visualizing Complex Data With Embedded Plots", Journal of Computational and Graphical Statistics, Vol. 24, No. 1, pp. 26-43.
Implementation Date:
    2015/8
Program 1:
     
    . Step 1:   Define the outer coordinate system
    .
    limits 0 10
    line blank
    multiplot scale factor 5
    embed on
    plot x for x = 1 1 9
    .
    . Step 2:   Now generate sub-plots
    .
    .           Note that in this case, the sub-plots
    .           are independent of the primary plot
    .
    frame corner coordinates 0 0 100 100
    tic marks off
    tic mark labels off
    title offset -10
    limits
    line solid
    .
    title x**2 for x = 1 1 9
    embed corner coordinates 2.5 4.5 3.5 5.5
    plot x**2 for x = 1 1 9
    .
    title -x for x = 1 1 9
    embed corner coordinates 7.5 6.5 8.5 7.5
    plot -x for x = 1 1 9
    .
    . Step 3:   Exit embed mode
    .
    embed off
        
    plot generated by sample program
Program 2:
     
    . Step 1:   Read the data
    .
    skip 25
    read morales2.dat y1 y2 y3 scan set standard
    let nset = unique set
    let nstan = unique standard
    .
    . Step 2:   Define the outer coordinate system
    .
    set let cross tabulate collapse
    let ymed = cross tabulate median y1 standard set
    let x1 = cross tabulate group one standard set
    let x2 = cross tabulate group two standard set
    let a1 = 0.25 quantile ymed
    let a2 = 0.50 quantile ymed
    let a3 = 0.75 quantile ymed
    let z0 = data a1 a2 a3
    region color red yellow cyan blue
    .
    xlimits 1 nstan
    major xtic mark number nstan
    minor xtic mark number 0
    x1tic mark offset 0.5 0.5
    x1label Experiment ID
    x1label displacement 5
    .
    ylimits 1 nset
    major ytic mark number nset
    minor ytic mark number 0
    y1tic mark offset 0.5 0.5
    y1label Set ID
    y1label displacement 5
    .
    frame corner coordinates 8 8 95 95
    title offset 2
    title Histograms of Y1 by Set and Experiment (MORALES2.DAT)
    .
    line blank
    embed on
    discrete contour plot y x1 x2 z0
    .
    title
    label
    limits
    major tic mark number
    minor tic mark number
    tic mark offset 0 0
    .
    . Step 3:   Now generate sub-plots
    .
    frame corner coordinates 0 0 100 100
    tic marks off
    tic mark labels off
    line solid
    xlimits 21.4 23.4
    ylimits 0 6
    .
    loop for k = 1 1 nstan
        let xc1 = k - 0.5
        let xc2 = k + 0.5
        loop for l = 1 1 nset
            let yc1 = l - 0.5
            let yc2 = l + 0.5
            embed corner coordinates xc1 yc1 xc2 yc2
            . kernel density plot y1 subset standard k  subset set l
            histogram y1 subset standard k  subset set l
        end of loop
    end of loop
    .
    . Step 4:   Exit embed mode and close the plot
    .
    embed off
        
    plot generated by sample program

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 08/06/2015
Last updated: 08/06/2015

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