OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis                     
 
Skip Navigation Links
All BooksExpand All Books
Origin HelpExpand Origin Help
GraphingExpand Graphing
Graph LegendsExpand Graph Legends

8.11 Graph Legends

Overview

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:

  • Double-click on the graph legend to enter "in-place" edit mode.
  • Right-click on the legend object and choose Properties.

General Legend Customizations

  • To delete the entire legend object:
Click to select the legend then press the Delete key, or right-click and choose Delete from the shortcut menu.
  • To show or hide the legend background:
Right-click on the legend object and choose Properties from the shortcut menu. Click the Frame tab and set Frame to None, Box, Shadow or Marble. Optionally, set Fill Color, Border Color, etc. If you set a background color, you may want to clear the White Out box on the Text tab.
  • To modify thickness or color of the line around the legend object (Frame = Box or Shadow):
Click to select the legend object. Use the Line/Border Color button Button Line Border Color.png on the Style toolbar to edit line color. Use the Line/Border Width list Button Border Width.png to set the line width. Alternately, use the controls on the Properties dialog Frame tab to modify Border Width and Color.
  • To resize the legend:
Select the legend object, then drag one of the green handles.
  • To arrange legend entries into multiple columns:
Select the 2D legend object, then hold Ctrl key to drag one of the green handles to arrange the legend entries into multiple columns.
ArrangeLegendEntries2015.png
  • 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 (the horizontal space devoted to the legend symbol):
Right-click on graph and choose Plot Details. At the graph page level, click the Legends/Titles tab, then enter a Legend Symbol Width (% of Font) (Note that the effect of this control varies depending upon plot type; for instance, it has no effect on symbol size of a line + symbol plot but it will increase the length of the line segment).
  • To change the line spacing between legend entries:
Right-click on the legend object and choose Properties. Edit the Line Spacing (%) list (enter value or choose from list).
  • To add a title to your legend:
Double-click on the legend text to enter "in-place" edit mode and insert your text directly into the legend object. Use the tools on the Format toolbar to format your text (including any substitution notation text).
  • To modify format of the legend text:
Click on the legend object to select it, then use the buttons on the Format toolbar. Note that some buttons will not be active unless you are in "in-place" edit mode (double-click to enter).
Format toolbar.png
Notes: To make the legend text color follow the legend symbol color such as
Legend Color Text Ex.png:
  • Set the font color as Auto on the Format toolbar or right-click the legend to select the Properties from the context menu to set the color to Auto in the Object Properties dialog.

Or,

  • Right-click on the legend object and choose Legend: Text Color Follows Plot.
  • To add special characters (symbols, Greek characters, etc.) to the legend:
Double-click on the legend text to go into "in-place" edit mode, then use the Font or Greek tools on the Format toolbar; or open the Symbol Map by right-clicking and choosing Symbol Map from the shortcut menu.
Greek symbols legend.png

Customizing the Data Plot Legend

The Data Plot Legend is the most common legend for many 2D and some 3D graphs.

Before proceeding to customize the data plot legend, you should know the difference between "updating" a legend and "reconstructing" a legend: Updating will preserve your customizations, reconstructing will not.

You can actively update or reconstruct the legend using shortcut menu commands (Update Legend or Reconstruct Legend) or by clicking the Reconstruct Legend Button New Legend.png toolbar button but be aware that there is also a Legend Update Mode setting at the page level in the graph's Plot Details dialog box. If you are adding or removing data plots from your graph, know that you could overwrite legend customizations if this control is set to Reconstruct....

  • To update the legend object when adding or removing plots from the graph:
Activate the graph and click Format: Page Properties. Click the Legends/Titles tab and set Legend Update Mode to Reconstruct when Adding/Removing or Update when Adding. If you set Legend Update Mode to None, you can always right-click inside the graph layer and choose Legend: Reconstruct Legend or Legend: Update Legend to refresh the legend object.
  • To construct a single legend for multiple layers:
Right-click inside the graph layer and choose Legend: Update Legend. In the legendupdate dialog box, set Update Scope to Whole Page; Update Mode to Reconstruct; and Legend to One Legend for Whole Page.
  • To reorder legend entries:
Select the legend object, then right-click and choose Legend: Reverse Order (default legends only); or open the legendupdate dialog box and use the Order controls. If neither gives the result you want, reorder by cutting and pasting legend entries, either in "in-place" edit mode or in the legend object's Properties dialog box (click to select the legend object, then right-click and choose Properties).
  • To show or hide certain legend entries:
Sometimes you may want to hide legend entries for hidden data plots, or for curves generated by fitting operations. To hide these plots, right-click on the legend object and select Legend:Show Legend for Visible Plots Only or Legend: Hide Legend for Fitted Curves.
  • To hide legend symbol(s):
Right-click on the legend and select Legend: Hide Legend Symbol from context menu. This selection is equivalent to setting Legend Symbol Width to 0% in the Legend/Titles tab of Plot Details dialog.
  • To show the active dataset indicator:
Right-click on the legend and select Indicate Active Dataset from context menu to show the indicator (a red box) around legend symbol. This selection is equivalent to checking Indicate Active Dataset in the Legend/Titles tab of Plot Details dialog.
Show active dataset indicator.png
  • 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 modify the size of all legend symbols, simultaneously:
Right-click on the legend object and choose Properties. Click the Symbol tab and set Symbol Size.
Increase plot symbol size.png
  • 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:
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 manually add a symbol and text to the legend object:
Right-click on the legend object and choose Properties. Click the Text tab, then click the Add Legend Symbol Add Legend Symbol.png button in the lower-right corner of the dialog. Manually add legend text following the legend "symbol" code. Symbol may be symbol or line or a combination.
  • To add a legend symbol that is completely 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).
  • 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.

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:

 

© OriginLab Corporation. All rights reserved.