# 1.3 Data Selection

In this lesson we will learn about flexible ways of selecting data for plotting.

### Plotting Data from Multiple Worksheets

1. Let's start with the project we saved in lesson two: Graph Templates and Batch Plotting. Select any workbook, and make sure no data columns are selected. You can click in the gray area outside of columns to remove selection.
2. Select menu Plot > Basic 2D: Line. The Plot Setup dialog will open.
3. Click the button on the right side to expand the upper panel if it is not already open.
4. Set the Available Data: drop-down list in the left panel to Worksheets in Folder.
 To pick up worksheets from anywhere in your project, set the drop down to Worksheets in Project.
5. Hold down shift key and select all three data sheets named Trial Run 1, Trial Run 2 and Trial Run 3.
6. Using the check boxes in the middle panel, assign Time as X and Position as Y. Click OK button to create the graph.
 This dialog has a third bottom panel which can be used to assign data to different layers in a multi-layer graph. If that panel is open, you can simply collapse it and then click OK to create the graph.

7. We will now customize the legend for this graph. Right click on the legend and select Legend: Update Legend...
8. In the dialog that opens, set Auto Legend Transition Mode as Custom. Clear the Legend Custom Format (@D, @LU etc) edit box and then click the button on the right of this edit box, and in the fly-out menu select @WS: Sheet Display Name.
9. In the edit box, type a hyphen - after the string@WS, and again click the right arrow button. This time select @LD"Sample": Sample, which corresponds to column header row Sample in the worksheet. Click the OK button. The legend will now display the sheet name and the sample name.

### Using another Column to Set Color of a Plot

1. Go to Project Explorer. In the upper panel, right-click on the root level and choose New Folder.
2. Right-click on newly created folder, select Rename, and assign the name Data Selection. Click on the empty folder and open it.
3. Start with an empty worksheet. Select Help: Open Folder: Sample Folder... to open the "Samples" folder. In this folder, open the Graphing subfolder and find the file US Mean Temperature.dat. Drag-and-drop this file into the empty worksheet to import it.
4. We want to plot the positions of US major cities (columns Longitude and Latitude) as a scatter plot and then colormap the data points with the annual mean temperature (column Annual). Click on the header of column named January and drag and expand the selection all the way to the column named December. Then right click to choose Hide/Unhide Columns: Hide.
5. Select the Longitude columns, then right-click and select Set As: X.
6. Select the Latitude and click Scatter button on the bottom left toolbar to create the plot of longitude vs. latitude.
7. Click on the plot, in the pop-up mini toolbar, click the Symbol Edge Color button to expand the color chooser, switch to the By Points tab. In this tab, click the Color Mapping drop-down and select Col(P): "Annual" in the list. The symbol color will be mapped to the column Annual.
8. Let us now set the axes lengths to scale with the range of X and Y values represented in the graph. Click on the white space of the layer to select the layer, in the pop-up mini toolbar, click Layer Dialogs button to select Properties from the fly-out menu.

The Plot Details dialog will be opened and with the Layer1 node been selected on the left panel. Then go to the Size tab on the right side. Check the Link Axis Length to Scale with X:Y Ratio box and keep the ratio as 1. Click OK to exit the dialog and see the effect.
 You also can double-click on the white space of the layer to open the Plot Details dialog with the Layer1 node been selected on the left panel.
9. Now, let us select another color palette to apply it to the symbol color as colormap. Click on any data point in the graph, and then click on the Palette toolbar button in the Style toolbar. Select the Temperature palette to better reflect the data. Click anywhere on the graph to deselect the plot.
 You can add a map to a graph using the Maps Online App. This blog post is a good place to start.

10. From the menu, choose File: Save Project and save your modified project.

### Selecting Multiple Non-adjacent Columns for Plotting

1. Open a new workbook window by clicking on the New Workbook button in the Standard toolbar.
2. Click the Import Excel button on Standard toolbar. In the file dialog that opens, browse to <Origin EXE Path>\Samples\Import and Export folder and select the file United States Energy (1980-2013).xls. Make sure that the Show Options Dialog check box is checked, and press OK.
3. In the import options dialog that opens, expand the Import Options > Header Lines node. Set the Number of Subheader Lines to <auto>, set the Long Names drop-down to 3 and the Units drop-down to 4. Then set the drop-downs for Comments From to 1 and Comments To to 2.
4. Check Apply Header to All Sheets so that these settings are used for every sheet in the Excel file.
5. Press OK to import the file. Then go to the first sheet named Oil. Hold the Ctrl key to select Crude Oil Production, Oil Consumption and Total Oil Production columns.
6. Then go to menu Plot > Multi-Panel/Axis: Stack... and accept default settings in the dialog, to create a stacked plot.
7. Save your project file.