
Chapter II-12 — Graphs
II-308
3. Choose Graph0Style from the Graph Macros submenu in the Windows menu.
4. Turn preferences back on by choosing Preferences On from the Misc menu.
If you use only the New Graph dialog, you can use the shorter method:
1. Open the New Graph dialog, select the wave(s) to be displayed in the graph, and choose
Graph0Style from the Style pop-up menu in the dialog. Click Do It.
Igor automatically generates the Preferences Off and Preferences On commands to apply the style to the
new graph without being affected by preferences.
Limitations of Style Macros
Igor automatically generates style macro commands to set all of the properties of a graph that you set via
the ModifyGraph, Label and SetAxis operations. These are the properties that you set using the Modify
Trace Appearance, Modify Graph, and Modify Axis dialogs.
It does not generate commands to recreate annotations or draw elements. Igor’s assumption is that these
things will be unique from one graph to the next. If you want to include commands to create annotations
and draw elements in a graph, it is not too difficult, following these steps.
1. Make your prototype graph with annotations and draw elements.
2. Use the Window Control dialog to create a graph recreation macro (not a style macro).
3. In the procedure window, copy the relevant commands from the graph recreation macro to the end
of the style macro. These are the commands that start with Tag, Textbox, Legend, or any of the
drawing-related operations. All of these commands will be at the end of the recreation macro.
There is a problem in using a Tag command in a style macro. This command needs to reference a particular
trace in the graph. It might look something like this:
Tag/N=text0 wave0, 10, "This is a test."
wave0 was in the prototype graph but it would probably not be in the target graph when the style macro is
applied. Your options would be to remove the Tag command from the style macro or to use the WaveName
function to provide an appropriate wave name when the macro is executed.
For example, to tag the first trace in the graph, you would use:
Tag/N=text0 $WaveName("",0,1), 10, "This is a test."
Even this would run into problems if the X scaling of the wave associated with the trace in the target graph
was different from the X scaling of the wave associated with the trace in the prototype graph, because the
parameter that sets the X location of the tag (10 in this case) would not be appropriate.
Also, the Tag command actually uses the name of a trace, not a wave. If the same wave is displayed more
than once, or if more than one wave with the same name is displayed, using $WaveName may attach the tag
to the wrong trace.
Where to Store Style Macros
If you want a style macro to be accessible from a single experiment only, you should leave them in the main
procedure window of that experiment. If you want a style macro to be accessible from any experiment then
you should store it in an auxiliary procedure file. See Chapter III-13, Procedure Windows for details.
Graph Pop-Up Menus
There are a number of contextual pop-up menus that you can use to quickly set colors and other graph
properties. To bring up a contextual menu on Macintosh, hold the Control key and click or, on Windows,
use the right mouse button. This is termed a contextual click.
Different contextual menus are available for clicks on traces, the interior of a graph (but not on a trace) and
axes. If you hold the Shift key before a contextual click on a trace or axis, the menu will apply to all traces
or axes in the graph.
Kommentare zu diesen Handbüchern