# 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 To to 1. Then set the axis Type to Probability (see below). Now click OK and we’ll have our basic graph.

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 Custom Positions (or By Dataset in older versions). In the Position or Dataset edit box enter the following text (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 (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.

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.

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:

Chris Drozdowski is a Product Support Engineer at OriginLab. He loves to talk to customers and educate them. He particularly relishes diagnosing and solving difficult, edge-case issues. As well, he contributes code to help solve problems or enhance user experience. In his down time at work, he likes to research and write about esoteric product features. Outside of work, he enjoys spending time with his family, having fun with C++, working on his aquarium, and exploring craft beers.

View all posts by Chris Drozdowski →