For graph with date and time axis, we can easily customize the display to only show information we are interested in, such as only show year, or month and date, etc. But how to show them into multiple lines for a neater look such as the image below?
This blog will summarize various options user may consider to customize the tick labels.
Please keep in mind that Origin’s mathematical system for date and time data is based on the Julian Day so that no matter what is displayed in worksheet or axis tick labels, the julian date is used in calculation and plotting.
Please download the attached opj file with a simpler data so you can follow the steps in blog. Unzip and open the opj file in Origin. There are two folders. results folder has 3 graphs with customized tick labels. Go to data folder to follow the steps.
a. Wrap Text Checkbox to Auto Wrap
- Under data folder, highlight column B and make a Line+symbol plot.
- Double click the x axis to go into the axis dialog. Under Scale tab, under Major Ticks branch, set Value to 1.5week. Click Apply. Now 5 major ticks are showing on the x axis.
- Go to Tick Labels tab. On Display sub-tab, Type is Date. Display dropdown list lists all built-in displays Origin support. You can also choose Custom Display to define your own display.
- Let’s set Display to 2016/12/14 HH.mm.ss. Click Apply. We can see in the graph, the x axis tick labels are running into each other.
- Go to Format sub-tab. Set the Wrap Text list to By Layer Length. The tick Labels are now separated into two lines. Go to the Scale tab and set Major Ticks > Type = By Increment and Value = 2week; Set Minor Ticks = By Counts and Count = 1.
b. Turn on Minor Tick label for Two Line Tick Labels
The setting Wrap Text > By Layer Length breaks the tick labels by the distance between adjacent ticks. We can turn on Minor Tick Label at major tick position to create a two-line tick label effect and specify exactly what we want to display for each line.
- Again highlight column B of Book1 and make a symbol-line plot.
- In the x axis dialog. Under Scale tab, under Major Ticks branch, set Value to 1.5week.
- Go to Tick Labels tab. On Display sub-tab, set Display to 2016/12/15.
- Go to Minor Tick Labels sub-tab. Make the following changes:
- Minor Tick Labels: Show at Specified Indices Only;
- Tick Indices: 1 — means show minor tick label at major tick position.
- Offset Major by (%): 100 — this will move major tick label down to get two line tick label effect
- Display Format: D5. D5 means the 6th item from the Display dropdown list on Display tab, which is the 3 letter abbreviation for days of week e.g. Mon, Tue.
- Click OK. The tick labels are now showing in two lines.
- This method guarantees a two-line tick label regardless of the length of each label.
- Only D0, D1, … kind of syntax can be used. You can customize it to be something not in the dropdown list.
c. Wrap Text with Custom Display for Multi-line Tick Labels
In case you need a more sophisticated display of the tick label, e.g., separate the label text to multiple lines, you may consider this method.
- Follow step 1,2 in the above procedure to plot the graph.
- Go to Tick Labels tab, on Display sub-tab, Set Display to Custom Display.
- A new edit box called Custom Display shows below it. Here you can freely define what to display.
- Paste the following text: ” hhtt MMMdd ——— yyyy” and click Apply button. Note: More format specifiers can be referred here.
- The tick label is customized to a single-line tick label: time, month in 3 letters, date, dashes and year.
- Go to Format sub-tab and check the box Wrap Text (or for recent versions of Origin, choose Wrap Text: By Layer Length). Click OK.
The tick labels will display in 4 lines. Wrap Text auto decides where to wrap. That’s why we added many blank spaces before and after each part to make label in each line center aligned.