1.38 FAQ-154 How do I customize the default axis titles and Legend?

Last Update: 10/24/2024

There are several ways to customize text in graph axis titles or legends, but the best solution is generally to make use of worksheet metadata -- often, but not limited to, column label row data -- as we have done in the following example.

FAQ154 Image 1 metadata.png

By default, the Line graph template used to make this graph, is configured to use the following label row data:


When the default template settings aren't satisfactory you can modify them, with the option of saving your customizations to a graph template. Consider the following:

FAQ154 Image 2 metadata.png

Special characters inserted as Rich Text or Unicode into the worksheet column label rows, are used directly in axis titles or legend text

.

Hard-coding Axis Title and Legend Text

In some situations, you may opt for direct entry of axis title or legend text. This may even be necessary if your data files do not contain useful metadata.

  1. Double-click on the axis title or legend text and overwrite the existing variable notation with your literal text. In-place editing of legend text is cumbersome and so as an alternative, you can edit text in the legend's Properties dialog.
  2. As with axis title and legend texts that incorporate worksheet metadata, "hard-coded" text can be saved with the template.

Customize Default Axis Title and Legend by Origin.ini File

Yet another option for customizing axis title and legend text, is to edit the Origin.ini file in your User Files Folder.

  1. Close Origin.
  2. Find Origin.ini file located in your User Files Folder (typically at C:\Users\user\Documents\OriginLab\User Files; if you don't find it there, you'll need to run Origin, open the Script Window (Window: Script Window), type "%Y=" and press Enter).
  3. Open the Origin.ini file in a text editor (e.g. Notepad) and find the [Text] section.
  4. Find the corresponding XTitle=, YTitle= and Legend= line to customize the part after =. It can be any text, including those that contain LabTalk substitutions notations. Note: ; Make sure ; is removed before XTitle=, Y=Title= and Legend= if you want to customize it.

For example, if the [Text] section of origin.ini contains the following:

[Text]
;Use workbook long name for default legend
Legend=\L(%d) %%(%d,@WL)\r\n

;The default X axis title is the long name
;of the first independent dataset
XTitle=%%(1X, @LL)
;The default Y axis title is the long name + unit
;of the first dependent dataset 
YTitle=%%(1Y, @LG)

Creating a default scatter plot from column B in the workbook shown in the following screenshot will yield the graph to its right:

Customize default legend.png

Note that the Long Name of the workbook is "Measured Data". It is displayed in the legend box. The Long Name of the X column ("Time") is used for the X axis title. The Y axis title is the Long Name ("Temperature") and the Units ("oC") of the Y column.

To display both plot's Y and X information in legend, change Legend line to be

Legend=\L(%d) %%(%dY, @LL)(%%(%dX, @LL))\r\n
Legend showX andY.png

Customizing Display of Units in Axis Title

This applies to Origin 2016 and newer versions.

To change the way that Units are displayed in the axis title:

  1. From the Origin menu, choose Preference:Options.
  2. In the Options dialog, click the Axis tab, then next to the Unit Display for Axis Title box, click the menu button and choose the desired display option (e.g. /<U> for Long Name / Units in place of Long Name (Units)).

Keywords:options, unit display, axis title, substitution notation, string substitution, special characters, graph template, escape sequences