### AutoGlyph

Category

Annotation

Function

Assigns an appropriate glyph to each point in a data field.

Syntax

    glyphs = AutoGlyph(data, type, shape, scale, ratio, min, max);

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`data` | data field | none | set of points to which glyphs will be assigned
`type` | scalar, string, field, or group | input dependent | glyph type
`shape` | scalar | 1.0 | factor to describe shape of glyph (must be greater than 0)
`scale` | scalar | 1.0 | scale factor for size of glyphs (must be greater than 0)
`ratio` | scalar | 0.05 or 0 | ratio in size (scalars or vectors) between smallest and largest glyphs (must be greater than or equal to 0)
`min` | scalar or field | min of data value or 0 | data value that gets minimum-size glyph
`max` | scalar or field | max of data | data value that gets maximum-size glyph

Outputs

Name | Type | Description
--- | --- | ---
`glyphs` | color field | set of glyphs

Functional Details

This module creates a glyph, or representation (e.g., an arrow), for each data value in a data field `data`. For data dependent on positions, a glyph is placed at the corresponding position. For data dependent on connections, a glyph is placed at the center of the corresponding connection element. If there is no "data" component, a glyph is placed at each position.

The "base" size (i.e. size of a glyph for the average data value) is based on AutoGlyph's estimate of an appropriate glyph size, as modified by `scale`.

For "text" glyphs, a "data" component is required.

AutoGlyph differs from the Glyph module in the interpretation of the `scale` parameter. For AutoGlyph, you specify the size of the glyphs relative to the default-size glyph chosen by AutoGlyph. In contrast, when using Glyph, you may specify a scaling factor that is multiplied by the data value to obtain the size of the glyph in world units.

`data` | is the data field for which glyphs are to be created.

`type`

specifies the kind of glyph to be used.

By default, scalar fields are represented by filled circles or spheres, vector fields by arrows, tensor fields by groups of arrows, and string data by text. For 2-dimensional scalar fields, the glyphs are circles, and for 2-dimensional vector fields, the arrows are flat. For 3-dimensional fields, spheres or rounded arrows (rockets) are used.

The `type` parameter will override a default glyph. If `type` is a string, it must specify one of the following: "arrow," "arrow2D," "circle," "colored text," "cube," "diamond," "needle," "needle2D," "rocket," "rocket2D," "sphere," "speedy," "spiffy," "square," "standard," or "text." The value "standard" specifies the default glyph type and is a medium-quality glyph appropriate to the data; "spiffy," a higher-quality glyph; and "speedy," a lower-quality, but more quickly rendered glyph. Lower quality glyphs also consume less memory.

You may alternatively specify `type` as a scalar value between 0 and 1, where:

- 0 is the same as "speedy"
- 1 is the same as "spiffy"
- 0.5 is the same as "standard"

There are approximately 5 different quality glyphs for each glyph type. The one closest to the value specified is used.

Specifying "text" or "colored text" for `type` puts a text representation of the data value at each point. For text glyphs, the text is by default 15 pixels high, and the `shape`, `ratio`, `min`, and `max` parameters have no effect. The `scale` parameter can be used to increase or decrease the size of the text glyphs. For example, specifying `scale` = 2 makes the text 30 pixels high. The difference between "text" and "colored text" is that text is always white when "text" is specified, but will be the color of the input if "colored text" is specified. Note that after the AutoGlyph module, Color can be used to color text glyphs to a different color if desired. The font for the text glyphs can be specified by appending "font = fontname" to "text" or "colored text," where fontname is any of the defined fonts supplied with Data Explorer:

    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. In addition, you may supply user-defined fields and groups to the `type` parameter (see reference #1).

The remaining five parameters are interpreted somewhat differently, depending on whether the type of data involved are (1) scalar or (2) vector or tensor.

#### Scalar Data

`shape` | is ignored for scalar data
`scale` | sets the scale factor for the size of the glyphs relative to the default glyph.
`ratio` | controls the ratio between the smallest and the largest glyphs. The default value is 0.05.

`min` and `max`

are the data values used to set glyph sizes. Their default values are the minimum and maximum data values respectively. Unless you change `ratio` from its default value of 0.05, the glyphs representing data with a value of `min` are 5 percent the size of the glyphs representing data with a value of `max`. You can make the size of the glyphs directly proportional to the data value by setting both `min` and `ratio` to 0.

Data values smaller than `min` are colored pale pink, unless the original positions already had colors, in which case the colors are left unchanged. These data values are represented by glyphs of a size proportional to
`min` - datavalue.

#### Vector and Tensor Data

`shape` | is used to change the thickness of the glyph relative to its length. The default value for `shape` is 1 (e.g., to make a glyph twice as thick, set this parameter to twice the default value (i.e., to 2).
`scale` | sets the scale factor for the size of the glyphs relative to the default glyph.
`ratio` | determines which data values are displayed. To display only those values larger than 0.5 * `max`, set this parameter to 0.5. The default value is 0.0.

`min` and `max`

are the data values used to set glyph sizes.

For 3x3 symmetric tensor data three arrows are drawn, representing the eigenvectors of the matrix. For 2x2 symmetric tensor data two arrows are drawn, representing the eigenvectors of the matrix. For vector data, one arrow is drawn, representing the magnitude of the data. The default value of `min` is 0 (zero), and the length of the glyphs is always directly proportional to the magnitude of the data (or the magnitude of the eigenvector). If you set `min` to a value greater than zero, all data with a magnitude smaller than `min` are represented by a dot if `type` is "needle," and by a small sphere otherwise. This can be useful to weed out small and perhaps noisy vectors. You can also set `ratio` to a value larger than zero; in that case, all data with a magnitude smaller than `ratio` × `max` is shown by a small sphere or dot. This allows you, for example, to set `ratio` = 0.5 to see only those vectors with a magnitude greater than half of `max`.

If you have vector data and want to show all the vectors as having the same length, you can use the `norm` function in the Compute module to normalize all the vectors to unit magnitude before passing them to AutoGlyph.

You can also use a field as the input for `min` and `max`, in which case the statistics of that field are used instead. If the input `data` is changing from frame to frame, and you want to keep the glyph sizes consistent from frame to frame, you can use the entire field or series as the input for `min` and `max`.

Note that if you set `min` and `max`, and there are data values far outside that range, then it is possible to get very large glyphs. This is because `max` is used to set the size scaling for the glyphs. Data values much larger in absolute value than `max` have proportionally larger-sized glyphs.

#### User-supplied and Annotation Glyphs

You may also pass your own glyph in as `type` as the object to place at each data point. The dimensionality of the positions of the glyph must be either 2-D or 3-D, and the connections type must be "triangles" or "lines." This glyph can be any Data Explorer field (e.g., an imported object, an isosurface, or a constructed object). (Ref #1.)

There are two ways to use your own glyphs: as user-supplied glyphs and as annotation glyphs.

User-supplied Glyphs

If you pass in a single field as `type`, that object is used as a glyph. It is drawn large or small depending on the data value, and it inherits the color of the data point, if present. The size of the object should be approximately unity for the default sizing of AutoGlyph to work well. Glyphs for scalar fields should be centered at the origin; glyphs for vector fields should have their base at the origin and the end that you want to point in the direction of the vector field at (0, 1, 0); that is, the glyph will be stretched along its y-dimension. You can use any combination of Scale, Rotate, and Translate to scale, orient, and position your template glyph before passing it to AutoGlyph.

Annotation Glyphs

If you pass in a group of objects as `type`, AutoGlyph interprets these as "annotation glyphs." Each object in the group must be a single field. It is assumed that you want data values equal to zero to be represented by the zeroth glyph in the group, data values equal to one to be represented by the first glyph in the group, and so on.

Thus the data component of `data` in this case must be of the type integer, unsigned integer, byte, unsigned byte, short, or unsigned short. The size of the glyph in the resulting output will be the size of the glyph in the glyph group, modified by the scaling factor `scale`. Colors and other components will be maintained from the input glyphs to the output object, rather than from the colors of `data`. The `shape`, `ratio`, `min`, and `max` parameters are ignored for annotation glyphs. Annotation glyphs should be positioned at the origin. You can use any combination of Scale, Rotate, and Translate to scale, orient, and position your template glyph before passing it to AutoGlyph.

Components

Creates new "positions" and "connections" components. In the case of a 3-D glyph, a "normals" component is added for shading purposes. All components that match the dependency of the "data" component are propagated to the output; all others are not. If the input has "binormals" and "tangent" components, they are not propagated to the output.

Example Visual Programs

    AnnotationGlyphs.net              ThunderGlyphSheet.net
    ConnectingScatteredPoints.net     UsingGlyphs.net
    PickStreamline.net                UsingTextAndTextGlyphs.net
    ProbeText.net                     SIMPLE/AutoGlyph.net

See Also

Glyph, Sample

How to Avoid Stretching or Squashing Glyphs

Users often use the Scale module to scale a collection of objects prior to rendering, if the axes have very different scales. This can cause a problem if the visualization includes glyphs, as the glyphs will be stretched or squashed as well. You can place the Scale module before Glyph or AutoGlyph, but if you want AutoAxes to show the original (rather than the scaled) position values, this will not work. One way of solving this problem lies in the fact that Glyph and AutoGlyph can accept a user-defined Glyph:

Give either module a "user-defined" glyph that is inversely squashed, so that when you use Scale, the glyph ends up with the correct shape. Proceed as follows:

- Create a field with a single point at the origin, using Construct ([0 0 0], data = 0) for scalar (sphere) glyphs
- Feed this field to either module to make a single sphere or arrow.
- Now scale the glyph, using a scale factor that is the inverse of the one you want to use on the entire data set. For example, if you are going to scale your data by [1 1 .001], then scale the single glyph by [.001 .001 1].
- Feed this scaled glyph to the second parameter of the module, which puts glyphs on all the data points. The module will use the squashed glyph as its template. After the template is scaled by [1 1 .001], the glyphs won't be squashed anymore.
- A macro, UnsquishGlyphMacro.net, which performs this operation, can be found in `/usr/local/dx/samples/macros`. This macro (and this technique) works only for scalar data.

[ OpenDX Home at IBM | OpenDX.org ]