8.9 Adding or Swapping Data Plots in the Graph Layer
Typically, Origin graphs are created by (1) selecting data and (2) clicking on a toolbar button or Plot menu command. Eventually, you may encounter situations in which you would like to manually add or remove one or more data plots in an existing graph and these procedures are discussed below.
Adding Plot into a Graph Layer with the Insert Plot to Layer Menu
This method supports only Line, Scatter, Line + Symbol, Column (or Bar) or Area plots. This is a straightforward method for adding selected worksheet data to the active graph layer. If you select multiple Y datasets (columns), the data are grouped in the layer and plot characteristics automatically increment by dataset.
To add a range of data to an existing line, scatter, line + symbol, column or area graph:
- Highlight your worksheet data.
- Click on the graph window to activate it.
- From the Origin menu, choose, Insert: Plot to Layer: Graph Type.
Note: If you want more control over the way in which plots are added to the layer -- being able to group the plots in the layer, for instance -- you can set a LabTalk system variable that will link the Add Plot menu command to the Plot Setup dialog box (note that there are other ways to open the Plot Setup dialog box).
To modify the behavior of the Plot to Layer menu command in the current session only, open the Command Window and at the command line type one of the following:
@LIP=0 <ENTER> //The Plot Setup dialog opens.
@LIP=1 <ENTER> //DEFAULT -- Selected datasets are added to the layer without opening the Plot Setup dialog box.
To make your change stick across Origin sessions, use the Set System Variables dialog box.
Adding a Function Plot or Parametric Plot into Current Layer
Since Origin 2019b, Origin supports to add a function plot or parametric plot into current 2D/3D graph layer directly by select Insert: Function Plot or Insert: Parametric Plot menu.
Once you selected the Insert: Function Plot or Insert: Parametric Plot menu, the Plot Details dialog will pop up with the Function tab been activated.
In the Function tab, you can define the function formula, the range of independent variables, the data point density and the script before running formula, just as the Create Function/Parametric Function Plot dialog.
Dragging Selected Data into the Graph Layer
You can create simple 2D plots by dragging and dropping selected worksheet data onto an Origin graph window. Note that this doesn't work for graphs which require Origin to do some behind-the-scenes calculating, as is the case with statistical chart types.
To learn more, see the topic Adding Data by Drag and Drop.
Adding Data into the Graph Layer by Copying and Pasting a Plot
You can copy a plot from an existing graph window and paste it into the same or another window.
- Click on the plot to select it and press CTRL+C.
- Click on the target graph and press CTRL+V.
Simultaneously, a ClipbN worksheet is created. You can open this worksheet by double-clicking on the plot, then clicking the Workbook button at the bottom of Plot Details; or right-click on the plot in the graph window or in the Object Manager and choose Create worksheet ClipbN.
You can also "paste" a copied plot to a worksheet cell. Select a cell and press CTRL+V to fill the column(s) with plot data.
Managing and Editing Plots in Layer using the dialogs
The Layer Contents dialog box
The Layer Contents dialog box is useful for:
- Easy adding and removing of datasets (data plots) from the active graph layer
- Filtering the list of available data, and sort by book, sheet, or long name etc to easily locate desired datasets
- Changing the order of datasets in the layer (affects plot drawing order)
- Grouping (or ungrouping) of datasets
- Editing the plot range
To learn more, see The Layer Contents Dialog Box.
The Plot Setup dialog box
The Plot Setup dialog box provides a flexible interface for:
- adding or removing of datasets (data plots) from any layer in the graph window
- specifying or modifying the plot type
- grouping (or ungrouping) of datasets
- editing the plot range
To learn more, see The Plot Setup Dialog Box.
Managing Plots with Object Manager
Once a graph is created, all plot elements will be listed as a tree-node structure in the Object Manager to help you manage the graph objects interactively.
With the Object Manager, you can
- Hiding/Showing plots
- Moving plots within the group/layer
- Moving plots between groups or between layers
- Removing a plot or special points
- Changing plot type quickly
- Switching to the Plot Details, Layer Content, and Plot Setup dialog
- Changing layer order and drawing order
To learn more, see the Object Manager.
Directly importing ASCII data into a Graph Layer
It is also possible to import an ASCII file directly into a graph window. This works only for a few simple plot types (line, line + symbol, column and bar). To learn more about this method, see Adding Data by Direct ASCII Import.
Changing the datasets associated with a plot
You can change datasets associated with a plot, using a context menu command:
- Click on the plot to select, then right-click and point to Change X/ Change Y/ Change Z(only for 3D and Contour Graphs).
- Choose another column from the original worksheet.
Note that you can override the original column plot designation using this method (e.g. you could point to Change X and select a worksheet column that was designated Y).
If you have multiple workbooks, each of which has a worksheet with ...
- identical sheet short names
- identical column short names
- identical column plot designations
- matching column indexes
... you can swap plots by choosing another workbook.
- To choose from datasets in another workbook, click on the plot to select, then right-click and point to Change Worksheet.