### ColorBar

Category

Annotation

Function

Creates a color bar.

Syntax

    colorbar = ColorBar(colormap, position, shape, horizontal, ticks,
                        min, max, colors, annotation, labelscale, font);

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`colormap` | field | none | color map
`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
`ticks` | integer | input dependent | approximate number of tick marks along the bar
`min` | scalar or object | map min | minimum value on bar
`max` | scalar or object | map max | maximum value on bar
`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
`ticklocations` | scalar list | appropriate | tick locations
`ticklabels` | string list | ticklocations | tick labels

Outputs

Name | Type | Description
--- | --- | ---
`colorbar` | color field | the color bar

Functional Details

The color bar generated by this module can be collected with the rest of the objects in the scene (by using a Collect module) and incorporated into an image.

`colormap`

must be a color map (e.g., the second output of AutoColor or the first output of the Colormap Editor). The input can also be an imported `.cm` file (see Import), in which case the color-map part of the color-opacity map is extracted and used. (A color map has a 1-dimensional "positions" component, representing the data values, and a 3-dimensional "data" component, representing the RGB color assigned to each data value.)

`position`

is a 2-dimensional vector (or a 3-dimensional vector whose z-component is ignored) indicating the position of the color bar in the final image. In viewport-relative coordinates, [0 0] places the bar at the lower left, and [1 1] at the upper right. These same coordinates determine the reference point that is used to position the bar relative to its placement in the image (e.g., for `position` = [0 0], the lower left corner of the bar is placed in the lower left corner of the image).

`shape` | is a 2-vector that specifies the length and width of the color bar, 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 color bar is vertical (0) or horizontal (1).
`ticks` | specifies the number of tick marks to be placed on the color bar (the actual number will at least approximate the specification). The default varies the number in accord with the size of the bar.

`min` and `max`

specify the limits of the color bar. The values can be scalar. If `min` is an object (a data field), the minimum and maximum data values of that field are used to set the corresponding limits of the bar. If `min` is scalar and `max` is an object (a data field), the maximum is the maximum data value of that field. When neither is specified, the minimum and maximum used are those of `colormap`.

`label` | specifies a user-supplied label for the color bar.

`colors` and `annotation`

set the colors of certain components of the color bar.

`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.

`ticklocations` | specifies the explicit location for tick marks. If specified, overrides the value as determined by `ticks`.
`ticklabels` | specifies the list of labels to be associated with the tick locations specified by `ticklocations`. If `ticklabels` is specified, and `ticklocations` is not specified, then `ticklocations` defaults to the integers 0 to n-1 where n is the number of items in `ticklabels`.

Notes:

1. `min` and `max`, if given, or the extent of the data if `min` and `max` are not given, set the extent of the color bar.

2. If you are using Render or Display to render an object which contains a color bar, when you change the resolution of the camera the size of the color bar in pixels will not change. Thus if you want the color bar to take up the same proportion of the image, use the ScaleScreen module to change the size of the color bar.

Example Visual Programs

    BandedColors.net

    Sealevel.net
    UsingColormaps.net
    UsingIsosurface.net
    VolumeRendering.net
    SIMPLE/ColorBar.net

    SIMPLE/ScaleScreen.net

See Also

AutoColor, AutoGrayScale, Color, Map, ScaleScreen, Legend

[ OpenDX Home at IBM | OpenDX.org ]