### Legend

Category

Annotation

Function

Creates a legend

Syntax

    legend = Legend(stringlist,colorlist, position, shape,
                    horizontal, label, colors, annotation, labelscale, font);

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`stringlist` | string list | none | list of strings for legend
`colorlist` | field, vector list, or string list | none | list of colors for legend
`position` | vector | [0.95, 0.95] | the position of the color bar (in viewport-relative coordinates)
`shape` | vector | [300 25] | length and width of the color bar (in pixels)
`horizontal` | flag | 0 | 0: vertical orientation 1: horizontal orientation
`label` | string | no defaults | label for color bar
`color`s | vector list or string list | appropriate | colors for annotation
`annotation` | string list | "all" | annotation objects to be colored
`labelscale` | scalar | 1.0 | scale factor for labels
`font` | string | standard | font for labels

Outputs

Name | Type | Description
--- | --- | ---
`legend` | color field | the legend

Functional Details

This module creates a legend associating a set of strings with a set of colors. The legend generated by this module can be collected with the rest of the objects in a scene (by using a Collect module) and incorporated into an image.

`stringlist` | is a list of strings for the legend
`colorlist` | is a colormap, a list of rgb vectors, or a list of color name strings (see Color for a discussion of valid color name strings). If `colorlist` is a list of rgb vectors or a list of color name strings, then the length of `colorlist` must be the same as the length of `stringlist`. If `colorlist` is a colormap (see Color for a description of a color map), then the colors are taken to be the values in `colorlist` corresponding to the integers 0, ... n-1 where n is the number of items in `stringlist`. Thus, for example, AutoColor or Color can be applied to a categorized string data set (see Categorize), and the colormap used can be directly passed to Legend to associate the appropriate colors with the categorized strings.
`position` | is a 2-dimensional vector (or a 3-dimensional vector whose z-component is ignored) indicating the position of the legend in the final image. In viewport-relative coordinates, [0 0] places the legend at the lower left, and [1 1] at the upper right. These same coordinates determine the reference point that is used to position the legend relative to its placement in the image (e.g., for `position` = [0 0], the lower left corner of the legend is placed in the lower left corner of the image).
`shape` | is a 2-vector that specifies the length and width of the legend , in pixels. For both horizontal and vertical orientations, the first element of the vector is the length and the second is the width.
`horizontal` | determines whether the orientation of the legend is vertical (0) or horizontal (1).
`label` | specifies a user-supplied label for the legend.
`colors` and `annotation` | set the colors of certain components of the legend. `colors` can be a single color (RGB vector or color-name string) or a list. The color-name string must be one of the defined color names (see Color). `annotation` can be a single string or a list of strings, chosen from the following: "all," "frame," "labels," and "ticks." If `annotation` is not specified or is "all"--and if `colors` is a single string--then `colors` is used for all color-bar annotation. Otherwise the number of colors must match the number of annotation strings exactly. The default frame color is "clear."
`labelscale` | determines the size of the axes and tick-mark labels. For example, `labelscale` = 2.0 will display the labels at double their default size.
`font` | specifies the font used for axes and tick-mark labels. You can specify any of the defined fonts supplied with Data Explorer. These include a variable-width font ("variable", the default for axes labels) and a fixed-width font ("fixed", the default for tick-marks labels).
    area          gothicit_t       pitman                roman_ext
    cyril_d       greek_d          roman_d               script_d
    fixed         greek_s          roman_dser            script_s
    gothiceng_t   italic_d         roman_s               variable
    gothicger_t   italic_t         roman_tser
For more information, see Appendix E. "Data Explorer Fonts" in IBM Visualization Data Explorer User's Guide.

Example Visual Programs

    HomeOwn.net
    Legend.net
    SalesOnStates.net

See Also

ScaleScreen, Color, ColorBar, Categorize

[ OpenDX Home at IBM | OpenDX.org ]