8.5 Graph Legends


Origin supports four legend objects and two scale objects. This page focuses on legend objects. For information on scale objects, see Color Scales and Bubble Scales.

The Data Plot Legend The Categorical Values Legend The Point-by-Point Legend Box Chart Components Legend
Graph Legends and Color Scales 001.png Graph Legends and Color Scales 2.png Graph Legends and Color Scales 04.png Graph Legends and Color Scales 05.png

Graph Legend Components

The four graph legends above share the following components:

Data plot legend components2.png

The graph legend is a special text object that is automatically created on the graph page. The legend object is given a specific name -- "Legend" -- and programmatically linked to your Origin project data using LabTalk notation. You will not see this notation unless you are editing the legend object. Normally, what displays is the "translated" symbol and legend text.

This image of a typical legend's Object Properties dialog box shows the LabTalk notation in the center of the dialog and the "translated" legend symbol and legend text -- what you actually see on the graph page -- in the lower part of the dialog.

Legend construction object properties.png

It is generally preferable to use plot-associated metadata in combination with dialog box settings, to create the legend symbol and text. For information on how to set that up, see:

However, you are not limited to programmed legends. At times, a manual edit of the legend object is the quickest way to get the job done. Since the legend is a text object, you can edit it using methods common to all text objects:

  • To open the Legend dialog box, press Ctrl + double-click on the graph legend text or right-click and choose Properties.
  • To enter "in-place" edit mode double-click.

Double-clicking on the graph legend symbol opens the Plot Details dialog box. Presing Ctrl + double-clicking on the graph legend text opens the Legend dialog box.

Legend Customization

There are Mini Toolbars dedicated to legend customization. Available buttons will vary by plot/legend type.

  • To display the toolbar, click the legend box or one symbol in the legend box.
    MT legend customization.png

And, you also can right-click on the legend to expand the short-cut menu to customize the legend:

Legend Context Menu.png
To do Using Mini Toolbar Using Other Controls
To delete the entire legend object Delete key, or Delete shortcut menu.
To add background to the legend box: Fill Color button Button Fill Color.png
To show or hide the frame of legend box: Frame button Popup Frame.pngin Style toolbar.
To modify thickness or color of the frame line Line/Border Color button Button Line Border Color.png and Line/Border Width list Button Border Width.png on the Style toolbar
To resize the legend Select the legend object, then drag one of the selection handles.
To arrange the legend entries Arrange in Horizontal OH legend MT arrainge in horizontal.png button
  • Graph: Legend: Arrange in Horizontal menu
  • Press Ctrl and drag a middle handle on one of the vertical sides
    Note that you cannot do this when Wrap Text is enabled.
To adjust padding between legend entries and the background Point to outside edge of the legend object and when the pointer becomes a "hand", click once to show handles. Drag a handle to add or subtract padding.
Legend adjust padding.png
To increase the legend symbol width Larger Symbol Width button Popup Larger Symbol Width.png and Smaller Symbol Width buttonPopup Smaller Symbol Width.png Legend Symbol Width (% of Font) in Legends/Titles tab of Plot Details.
To change the line spacing between legend entries Line Spacing (%) list in Text tab of Text Object - Legend dialog.
To adjust the symbol size Increase Scatter Symbol Size button Popup Scatter Symbol Size Increase.png and Decrease Scatter Symbol Size buttonPopup Scatter Symbol Size Reduce.png Click the Symbol tab and set Scatter Symbol Size in Text Object - Legend dialog.
Increase plot symbol size.png
To modify the legend symbol line width Increase Line Thickness button Popup Line Thickness Increase.png and Decrease Line Thickness buttonPopup Line Thickness Reduce.png Click the Symbol tab and set Line Thickness in Text Object - Legend dialog.
Legend symbol line thickness.png
To modify format of the legend text Set Font, Font Size, Increase Font Size , Decrease Font Size and Font Color button
MT LegendFont.png
Format toolbar.
Format toolbar.png
Note: Some buttons are only available in "in-place" edit mode (Ctrl + double-click to enter).
To make the legend text color follow the symbol color Set Font Color button Popup Font Color.png to Auto
Legend Color Text Ex.png
  • Right-click on the legend object and choose Legend: Text Color Follows Plot
  • Set the font color as Auto on the Format toolbar
To add special characters (symbols, Greek characters, etc.) to the legend Click More button Popup Open Properties Dialog.png to select
MT More Menu.png
  • Under "in-place" edit mode, use the Font or Greek tools on the Format toolbar
Greek symbols legend.png
  • Right-click and choosing Symbol Map from the shortcut menu
To reorder legend entries Reverse button Popup Reverse.png
  • Legend: Reverse Order menu
  • Reorder by cutting and pasting legend entries, either in "in-place" edit mode or in the Object Properties dialog
To update the legend object after adding or removing plots/special points Reconstruct Legend button Popup Reconstruct Legend.png
  • Legend: Reconstruct Legend or Legend: Update Legend short-cut menu
  • Set Legend Update Mode to Reconstruct when Adding/Removing or Update when Adding in Legends/Titles tab of Plot Details.

Once the control Show Legend for Visible Plots Only has been checked from the context menu or in the legendupdate dialog box , if you hide/romove a plot, the legend box will be reconstructed and updated to only show the remaining plots.

To construct a single legend for multiple layers Legend: Update Legend short-cut menu. In the legendupdate dialog box, set Update Scope to Whole Page; Update Mode to Reconstruct; and Legend to One Legend for Whole Page.
To show or hide certain legend entries Click Show/Hide button Popup Show Hide.png to select
MT ShowHide List.png
Legend:Show Legend for Visible Plots Only, Legend: Hide Legend for Fitted Curves or Legend: Hide Legend for Fucntion Plots short-cut menu
To hide legend symbol(s) Click Show/Hide button Popup Show Hide.png to select
MT ShowHide Symbol.png
Legend: Hide Legend Symbol short-cut menu
To show the active dataset indicator Indicate Active Dataset button Popup Indicate Active Dataset.png
  • Legend: Indicate Active Dataset short-cut menu
  • Indicate Active Dataset in the Legend/Titles tab of Plot Details dialog.
Show active dataset indicator.png
To attach the legend texts to plots Attach to Plots button Popup Attach to Plots.png Legend: Attach to Plots short-cut menu


  • This operation will make the legend text attach to the last data points of the plots, then you can double-click on the text to open the Label tab of Plot Details to customize it.
  • A system variable @ALP can be used to specify whether the plot labels will follow the translation mode change of legend text.
To change the legend text to other variable of the plot(such as the column label rows) Data Plot Legend Translation Mode button Popup Data Plot Legend Translation Mode.png to select

MT Legend TranslationMode.png

Translation Mode of %(1),%(2) control in in Legends/Titles tab of Plot Details.
To wrap the legend text Wrap Text button Popup Wrap Text.png Go to Frame tab of Text Object - Legend dialog, check Wrap Text, Adjust Height.

If you are manually editing legend text and you need to wrap a long string, see the \ww(literal text) escape sequence. Also, see use of "%(CRLF)" to hard-code a line break (next).

To change legend symbol block height/width Pattern Block buttons

MT Legend PatternBlock.png

Legend Symbol Block Width and Legend Symbol Block Height drop-down list in Symbol tab of Text Object - Legend dialog
To use "dumbbell-shaped" symbols in Line + Symbol legends Symbol+Line Style drop-down list in Symbol tab of Text Object - Legend dialog
Legend double symbol.png
To align the legend text
  • Alignment drop-down list in in Text tab of Text Object - Legend dialog
  • Alignment button on Format toolbar
    Format Toolbar Alignment.png
To reconstruct legend to show only one legend type, and update legend automatically Right-click on the legend, select Use One Legend Type Only and Auto Update
To remove repeated legend entries when you used one column label row to control plot color Reconstruct Legend button Popup Reconstruct Legend.png Right-click on the legend, select Legend: Reconstruct Legend

Other Manual Customization Tasks

  • To modify the size of a single legend symbol:
Use the \L([LayerIndex.]PlotIndex[,PointIndex][,S:SizeOption]) syntax. The SizeOption can be specified in two ways: S:##, where ## is the point size of the plot symbol (upper-limit of approx. 16 pt); or S:p##, where p## is the percentage of the font size (values limited to 1 - 99). So, for example, the legend notation might read \l(3,s:24) %(3), where s:24 specifies a symbol size of 24 points; or \l(3,s:p50) %(3), where s:p50 specifies a symbol size that is 50% of font size. For a complete explanation of this notation, see Legend Substitution Notation.
  • To insert information in worksheet column label rows into the legend text:
Use the legendupdate dialog box. Right-click inside the graph layer and choose Legend: Update Legend. Choose a legend text option from Auto Legend Translation Mode. For more options, choose Custom then click the arrow to the right of Legend Custom Format (@D, @LU etc). Note that Custom allows header information to be concatenated. See this topic for a complete list of @options.
  • To manually insert worksheet column label row information into the legend text:
Use the syntax %(PlotIndex,@option). To combine multiple @options interspersed with arbitrary text, use %(PlotIndex,@(@option1+@option2+...)) as shown below. See this topic for a complete list of @options.
Manual insert col label legend.png.
  • Another option for inserting worksheet-stored variable information into the legend text:
Ctrl + double-click on the legend text to enter "in-place" edit mode. Right-click and choose Insert Info Variables from the shortcut menu. For more information on the Insert Variables dialog box, see this page.
  • To hard-code a line break into the legend text:
In the legendupdate dialog box, set Auto Legend Translation Mode to Custom and insert "%(CRLF)" into your format string. You can do the same thing in Plot Details. Go to the Legends/Titles tab, set Translation mode of %(1), %(2) to Custom and enter your custom legend text, to include "%(CRLF)" at the point where you want the text to break to a new line.
  • To add a separator between lines of legend text:
See Inserting Line Separators in the Legend Object.
  • To manually add legend symbols and text that are independent of any data plot:
Double-click on the legend object to open the Legend dialog box. Click the Text tab, then click the Add Legend Symbol Add Legend Symbol.png button in the lower-right corner of the dialog. Start a new line in the text box, add your legend symbol then manually add your legend text following the legend "symbol" code. Note that "symbol" may be symbol, line or line + symbol.
Legend custom entry.png
  • Other methods for adding legend symbols that are independent of any data plot:
Use the syntax outlined here.
  • To ensure that your legend customizations cannot be overwritten by reconstructing:
Rename the legend object. Right-click on the legend and choose Properties. Click on the Programming tab and change Name to something other than "Legend".
  • To apply your legend customizations to another graph legend:
Right-click on the customized legend, select Copy Format and choose an option. Right-click on the target legend and choose Paste Format To and choose an option (see Copying and Pasting Formats).

Customizing Special Legends

The four types of legend objects can co-exist in one graph. For example, you may have multiple Y datasets and plot them as a box chart. However, you would like to show both the data plot legend and the box chart component legend.

  • Once a graph is created, clicking the Reconstruct Legend Button New Legend.png toolbar button will create the most appropriate legend for your graph.
  • When you right-click a legend object and point to the Legend context menu, the 1st group in the sub-menu will show applicable legend objects for your graph. If you choose one of these legends, it will be appended to the existing legend. Note: Each type of legend object can appear only once in the graph layer.
  • The same menu options are also available from the Graph menu and when right-clicking in the graph.
  • Each special legend has a corresponding dialog for customizing the menu.
Categorical Values Legend
Point-by-Point Legend
Box Chart Components Legend

Topics covered in this section: