Showing Axis Ticks at Custom Positions in a Graph

There may come a time when you want to completely customize the position of ticks and tick labels for a graph axis in Origin. In this blog post, we will customize the X axis of a probability plot of flood recurrence intervals along a certain river (using theoretical data). This kind of plot is used by hydrologists to visualize historical data for prediction purposes. If you want to follow along with this post, download the Origin Project file (zipped) here: TicksAtCustomPositions.zip

 

We’ll start by creating a scatter plot of the XY data in our worksheet. Then we’ll delete the Legend and then open the Axis Dialog with the X axis (Horizontal) selected. In the Scale tab for the axis, set the From to 99.5 and To to 1. Then set the axis Type to Probability (see below). Now click OK and we’ll have our basic graph.

custaxistick1plot

 

We now want to convert the X-axis to display Recurrence Intervals, a notation used by hydrologists to express probability. We will use the numbers in the following table to customize both the tick positions and labels.

 

Tick Position 99.01 95.24 80 66.6 50 33.3 20 10 5 2
Tick Label 1.01 1.05 1.25 1.5 2 3 5 10 20 50

 

So reopen the Axis Dialog and go back to the Scale tab for the X axis. Under Major ticks, set the Type to By Dataset. In the Dataset edit box enter the following text (without the quotes) (see image below left):

99.01 95.24 80 66.6 50 33.3 20 10 5 2

Notice that the text is all of our tick position values from the table above with each value being separated by a space character. This will cause Origin to only show ticks at those axis positions.

Now let’s set our custom labels. Again in the Axis Dialog, Navigate to the Display sub-tab of the Tick Labels tab. Set the Type to Tick-indexed String and in the Display edit box enter the following text (again without quotes) (see image below right):

1.01  1.05 1.25 1.5 2 3 5 10 20 50

This causes Origin to associate the custom labels with the custom tick positions we defined based on the index of each value.

custaxistick2ab

 

Alternately, we can use a formula to define our tick labels instead of hard-coding them. Reopen the Axis dialog and return to the Display sub-tab of the Tick Labels tab. This time, set the Type to Numeric, the Display to Custom, and the Custom Format to .2* (see below). In the Formula edit box, enter 100/x. In this formula, the x values are the values we previously entered in the Major Tick Type: By Dataset while the Custom Format tells Origin to display the values to 2 decimals places but also to drop trailing zeros. Using this method produces the same results as hard-coding the tick labels.

custaxistick4plot

 

Finally, we can customize our graph by changing the symbol shape, size, and color. We can also add vertical grid lines and a title, and adjust font sizes. Below is our finished graph:

custaxistickfinished

 

Leave a Reply

Your email address will not be published. Required fields are marked *