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.

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 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.

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

 

About Chris Drozdowski

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 →

2 Comments on “Showing Axis Ticks at Custom Positions in a Graph”

  1. We trust that you are doing well in these trying times,

    We have tested 5 entomopathogenic nematodes against fall armyworm larvae in different concentrations and carried out the probit analysis using SAS software.

    In the manuscript, we have plotted only per cent mortality on left y axis and nematode original concentration x axis but the reviewer suggested to include the left Y-axis per cent mortality and in the right Y-axis probit units, and x axis nematode concentration log form.

    I have tested five nematode in four concentration I want to plot all in one graph using origin software. I am unable to adjust right y axis, therefore I need your help and guidance on how to plot these data using origin software. I am ready share my data set also.

Jagadeesh Patil にコメントする コメントをキャンセル

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です