| iTool User's Guide: Working with Styles |

## Applying Styles

Styles can be applied to a single item or all items within a view. When a new visualization is added to an existing tool, the style of any previous visualization will not be automatically applied unless the preferred style is set as the default style (as described in Setting the Default Style) or unless the STYLE_NAME keyword is used. STYLE_NAME allows you to specify the name of a user-defined or system style to be applied to the created visualizations.

Changes to style properties are not automatically reflected in your visualization. To update a visualization with a modified style, you must reapply the style.

When the Update current tool style checkbox is selected on the Apply Style dialog, the Current Style is updated. Any properties set in the style you have just applied are also changed in the Current Style. Other properties are left unchanged. Any new visualizations added from that point on will have the updated style applied.

Applying a style modifies only applicable items. If the style does not contain any properties that are relevant to the selected item or visualization, no changes are made to the visualization.

Note Selecting Edit Undo/Redo will completely undo the application of a style. If a style is applied and Undo is selected, all properties changed by the style revert to their pre-application values.

### Applying a Style to a Selected Item

You can apply a style to selected items in a visualization. For example:

1. From the IDL Command Line, visualize the following simple line graph:

    iPlot, RANDOMU(seed, 30)

2. Highlight and select the plot line by clicking on the line.

3. Select Edit Style Apply Style...

The Apply Style dialog appears (as shown in the following figure). Here you can select your preferred style to be applied to the plot item.

Figure 9-5: The Apply Style Dialog

Figure 9-5: The Apply Style Dialog

4. After selecting your preferred style (here MyNewStyle1 has been selected), choose Apply to selected items so that the style changes will only be made to the selected item. MyNewStyle1 was created to contain properties to change line color, plot symbol type, and axis color. Because Apply to selected items is selected and not Apply to all items in view, you can expect that the axes will remain their original color (black).

Note If a particular existing style does not contain style information for an item that you have selected (for instance, if a style does not contain text information and you have selected a text item), no changes will be made to that item when the style is applied.

1. Click OK and your style changes will be visualized (as shown in the following figure).

Figure 9-6: iPlot Window Before (background) and After (foreground) Style Selection Application Changes Line Color and Plot Symbol Only

Figure 9-6: iPlot Window Before (background) and After (foreground) Style Selection Application Changes Line Color and Plot Symbol Only

Note If nothing is currently selected, then style will be applied to the Visualization Layer within the current view.

### Applying a Style to All Items

You can also apply a style to all items within a view. For example:

1. Visualize a surface from the IDL Command Line by typing:

    iSurface, dist(20)

2. Next add a text annotation to your image reading: New Surface.

3. Now select Edit Style Apply Style...

4. The Apply Style dialog appears (as shown in the following figure), here you can select your preferred style to be applied to the text item.

Figure 9-7: The Apply Style Dialog

Figure 9-7: The Apply Style Dialog

5. After selecting your preferred style (here IDL Classic has been selected), select Apply to all items in current view so that the style changes will be made to all the items in the view.

Note Selecting Apply to all items in all views applies the style changes to every item in every view available in the current iTool (e.g., an iPlot tool subdivided into four views using the VIEW_GRID keyword from the command line).

6. Click OK and the style is applied to the entire visualization.

Figure 9-8: iSurface Window Before (left) and After (right) Entire Style Application

Figure 9-8: iSurface Window Before (left) and After (right) Entire Style Application

Note Applying a style to all items will ignore items that have the Show property is set to `False` (i.e. hidden items).

### Applying a Style When Launching an iTool

The STYLE_NAME keyword allows you to apply a style to a visualization when an iTool is launched from the command line. This keyword can be used with any of the iTool routines (ICONTOUR, IIMAGE, IMAP, IPLOT, ISURFACE, IVECTOR, and IVOLUME).

Several system styles are included in your IDL distribution. For more information on setting a system style or created style, see Setting the Default Style.

Note Styles specified in the STYLE_NAME string override the default style.

IDL Online Help (March 01, 2006)