# How to Move a Plot to Right Axis

Origin has many built-in graph templates to plot data with against double Y, 3Y, 4Y, or many Y axes. But sometimes users ask how to plot data in an existing graph against a new axis scale, such as right Y axis. The traditional way is cumbersome: Move the plot out of an existing layer, create a new layer and then add the plot into this new layer.

Origin 2017 SR1 added a new tool to make it easy.

This blog will demonstrate this. Please first download the Move_Plot.zip file and open it in Origin 2017 SR1. There are two folders in the opj file. Data folder shows data and the original plot. Result folder shows the resulting graph after moving the plot.

### Steps:

1. Go to Data folder. In Graph1, obviously you can’t see details of Annealing nor Differential data since their Y ranges are very different. It’s not appropriate to plot them together with same Y axis scale. Let’s plot Differential data (2nd plot) against a new right Y axis.

2. With Graph1 window active, choose Window: Script Window menu.

3. Type laymplot -d in Script window and press Enter key to execute it. laymplot is a new X-Function added in Origin 2017 SR1. There is no menu or toolbar hooked up with it.

4. A dialog will open for you to specify which plot to move. Set it as follows.

Explanation:

• Plot to Move: 2 means move the 2nd plot in active layer. From the legend of the original graph, you can tell Differential is the 2nd plot.
• Target Layer: 0 means new layer. If there are already multiple layers in the graph. You can specify an existing layer, e.g. 2 means 2nd layer.
• Layer Setting:Independent Y Linked X. means it will add a new layer with same X axis scale as the current layer. And since current Y axis is on the left, a new independent Y axis will be added on the right.
• Show Linked Axis for Both Sides: means it will show linked X axis on the top.
• Rescale Layer: Source and Target means after moving plot, the X and Y axis in source and target layers will be rescaled to show all data.

5. Click OK. Differential is plotted against right Y axis.

6, You will notice the color of the moved plot isn’t kept. Also legend doesn’t update accordingly. These are limitations of this laymplot tool. So you need to manually change it to red.

7. To make the right Y axis line and ticks, tick labels, and axis title show the same color as the plot, double click right Y axis to open the Axis dialog.

8, Go to Line and Ticks tab. Set Line Color to Auto. Set the color on Title tab, Tick Labels -> Format tab to Auto as well.

Graph will look as follows.

9. Right click the legend and choose Legend: Update Legend… from context menu.

10. Set Update Mode to Reconstruct and also set Legend to One Legend for Whole Page.

11. Click OK. Move legend to desired location. You will get the final graph.

Note:

• In Plot to Move box, enter 2 4 (space separated) to move 2nd and 4th plot together.
• If there are already multiple layers in the graph, you will need to activate the layer where the plot is first before running the script.