Skip to main content

Legend

Legend [/A=attach /C/E[=exterior]/F=frame /H=legendSymbolWidth /H={legendSymbolWidth, minThickness, maxThickness } /J/K /M[=saMeSize]/N=name /R=newName /S=style /T=tabSpec /V=vis /W=winName /X=xoffset /Y=yoffset ] [legendStr ]

The Legend operation puts a legend on a graph or page layout.

Parameters

legendStr contains the text that is printed in the legend.

If legendStr is missing or is an empty string (""), the text needed for a default legend is automatically generated. Legends are automatically updated when waves are appended to or removed from the graph or when you rename a wave in the graph.

legendStr can contain escape codes which affect subsequent characters in the text. An escape code is introduced by a backslash character. In a literal string, you must enter two backslashes to produce one. See Backslashes in Annotation Escape Sequences for details.

Using escape codes you can change the font, size, style and color of text, create superscripts and subscripts, create dynamically-updated text, insert legend symbols, and apply other effects. See Annotation Escape Codes for details. However normally you leave it to Igor to automatically manage the legend.

See Legend Text for a discussion of what legendStr may contain.

Flags

/H=legendSymbolWidth
Sets the width in points of the area in which to draw the wave symbols. A value of 0 means "default". This results in a width that is based on the text size in effect when the symbol is drawn. A value of 36 gives a .5 inch (36 points) width which is nice in most cases.
/H={legendSymbolWidth, minThickness, maxThickness }
This is an additional form of the /H flag. The legendSymbolWidth parameter works the same as described above.
The minThickness and maxThickness parameters allow you to create a legend whose line and marker thicknesses are different from the thicknesses of the associated traces in the graph. This can be handy to make the legend more readable when you use very thin lines or markers for the traces.
minThickness and maxThickness are values from 0.0 to 10.0. Also, setting minThickness to 0.0 and maxThickness to 0.0 (the default setting) tells Igor to use the same thicknesses for the legend symbols as for the traces.
/JDisables the default legend mechanism so that a default legend is not created even if legendStr is an empty string ("") or omitted.
Window recreation macros use /J in case legendStr is too long to fit on the same command line as the Legend operation itself. In this case, an AppendText command appears after the Legend command to append legendStr to the empty legend. For really long values of legendStr, Igor might generate multiple AppendText commands.
/M[=sameSize]
/M or /M=1:Legend markers should be the same size as the marker in the graph.
/M=0:Same-size mode off. The size of the marker in the legend is based on text size.

See the TextBox operation for documentation for all other flags.

Details

A legend can have at most 100 lines. We don't expect anyone to come even close.

Examples

The command Legend (with no parameters) creates a default legend. A default legend in a layout contains a line for each wave in each of the graphs in the layout, starting from the bottom graph and working toward the front.

The command:

Legend/C/N=name ""

changes the named existing legend to a default legend.

You can put a legend in a page layout with a command such as:

Legend "\s(Graph0.wave0) this is wave0"

This creates a legend in the layout that shows the symbol for wave0 in Graph0. The graph named in the command is usually in the layout but it doesn't have to be.

See Also

Legend Text, TextBox, Tag, ColorScale, AnnotationInfo, AnnotationList, Annotation Escape Codes

Trace Names, Programming With Trace Names

Color as f(z) Example for a discussion of creating a legend whose symbols match the markers in a graph that uses color as f(z).