8.5 Graph Legends
Contents
- 1 Overview
- 2 Graph Legend Components
- 3 General Legend Customizations
- 4 Customizing the Data Plot Legend
- 5 Customizing Special 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 Legend Components
The four graph legends above share the following components:
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.
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:
- The Plot Details Legends/Titles tab
- The legendupdate Dialog Box.
- Displaying Supporting Data in Worksheet Header Rows
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.
General Legend Customizations
| There are Mini Toolbars dedicated to legend and color scale customization. Available buttons will vary by plot/legend type. To display the toolbar, click to select the legend or color scale object.
|
- 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:
Double-click on the legend object to open the Legend dialog box. 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
on the
Style toolbar to edit line color. Use the
Line/Border Width list
to set the line width. Alternately,
use the controls on the Legend dialog's
Frame tab to modify
Border Width and
Color.
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.
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.
Note: For the legend for 3D graph, you are also allowed to adjust the padding like this.
- 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 element; 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:
Double-click on the legend object to open the Legend dialog box. On the
Text tab, edit the
Line Spacing (%) list (enter value or choose from list). Beginning with Origin 2022b, you can create irregular spacings
(i.e. groupings) among entries.
- To add a title to your legend:
Ctrl + 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 (Ctrl + double-click to enter).
Notes: To make the legend text color follow the legend symbol color such as
:
- 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:
Ctrl + 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.
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
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 hide legend for fitted curves or function plots:
Right-click on the legend and select
Legend: Hide Legend For Fitted Curves /
Legend: Hide Legend For Function Plots from context menu.
- 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.
- To add a
special point to your legend (line, scatter, line+symbol, column/bar):
You can customize a single data point. Beginning with Origin 2018SR0, you can automatically add such points to the graph legend by right-clicking on the legend and choosing
Legend: Reconstruct Legend.
-
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:
Double-click on the legend to open the Legend dialog box. Click the
Symbol tab and set
Scatter Symbol Size. Enter a value or choose from the list. Values > 100 (%) are supported.
- To modify the legend symbol line width:
Double-click on the legend to open the Legend dialog box. Click the
Symbol
tab and set
Line Thickness. Enter a value or choose from the list. Values > 100 (%) are supported.
- To use "dumbbell-shaped" symbols in Line + Symbol legends:
Double-click the legend to open the Legend dialog box. Click the
Symbol tab and choose from the
Symbol+Line Style drop-down list.
- To change the legend symbol block width:
Double-click the legend to open the Legend dialog box. Click the
Symbol tab and choose from the
Legend Symbol Block Width
drop-down list.
See To increase the legend symbol width, above.
- To change legend symbol block height:
Double-click the legend to open the Legend dialog box. Click the
Symbol tab and choose from the
Legend Symbol Block
Height drop-down list.
- 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.
.
- 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.
Right-click on the legend object and choose
Properties. Click on the
Frame tab and check
Wrap Text, Adjust Height. Alternately, select the object and use the
Wrap Text button on the Mini
Toolbar. This works for column metadata (e.g. Comments (1st line)) in auto-generated legends. 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 right-align legend
text:
Right-click on the legend object and choose
Properties. On the
Text tab, set the Alignment drop-down to Right.
- 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
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.
- 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).
- 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
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
Which button is used to insert a chart?
On the Insert tab, in the Illustrations group, click Chart. In the Insert Chart dialog box, click the arrows to scroll through the chart types. Select the type of chart that you want and then click OK.
Which tab is used to select chart?
Click the Insert tab of the ribbon. Click the Line button in the Charts group. Select a format option from the Line Chart drop-down menu.
How do you insert a chart with the recommended chart button?
Select the data you want to use for your chart..
Click Insert > Recommended Charts..
On the Recommended Charts tab, scroll through the list of charts that Excel recommends for your data, and click any chart to see how your data will look. ... .
When you find the chart you like, click it > OK..
Which tab allows you to create a chart from selected data Excel?
To create a chart, the first step is to select the data—across a set of cells. Sometimes, you may not want to display all of your data. You can choose which so you can choose the specific columns, rows, or cells to include. After you select your data, on the Insert tab, select Recommended Charts.