Using Excel to Graph Data Objectives After this presentation you should understand how to: ◦ ◦ ◦ ◦ ◦ ◦ ◦ Properly add headings. Make Excel treat a cell as a constant. Propagate equations. Control the number of visible decimal places. Use special equations. Put borders around your tables. Create and format a scatter plot from data. Entering Data Start by putting in the column headings near the top of the page. There should be places for both your data and any constants for the experiment. Inside the heading, each entry should have units listed in parentheses (ex. (kg)). Never put the units in the same cell as the numerical values. Make sure that the column widths are wide enough to see the entire headings. When entering data, make sure that the entries are all centered. Locking References in Excel Enter the value you want to use as a constant in its own cell. Locking References in Excel Usually when an equation in moved in Excel the cells that it referenced change as well. This can be stopped by putting a $ in front of the part of the reference you want to lock. A $ in front of the letter locks the row reference. $ in front of the number locks the column. (ex. $B$3). This can be used in equations instead of typing the number. Locking References in Excel Propagating the equation down the column now does not change the locked cell reference. Propagating Equations If you need to use the same equation multiple times there is a way to avoid rewriting it. Select the cell and bring your curser to the lower right corner, it should change into a black cross. Clicking and dragging with the cross will bring the equation down rows or across columns. Any cell references that were not locked will automatically change as the equation is propagated. Changing Shown Decimals You should change the number of visible decimal places to match the significant figures in each entry using the buttons in the file menu. Average Values To find the average of a set of values in Excel, type into a cell =AVERAGE(), and highlight the cells you want the averaged while inside of the parentheses. Other Equations Excel has other equations programmed into it that may be useful, such as: ◦ ◦ ◦ ◦ ◦ ◦ PI Absolute value Cosine, Sine Radians Square root Arcsine pi() abs() cos(), sin() Radians() sqrt() asin() Borders You should put borders around your cells. Select the cells to have borders and go the home tab. Open the menu underneath the font size and select “All Borders”. Borders ◦ Select your data and add borders. Graphing Excel can also make graphs for data analysis. To graph, go to the insert tab and click on the scatterplot button. Graphing This will create a blank scatterplot. You will need to right click on the plot and click on “select data”. Click on “add” to add a data series. This will bring up a new window that will allow you to enter the x and y variables. Graphing To enter the values, you can just click on one of the entries and highlight the cells you want to use for that axis (get rid of the ={1} in the y values). Don’t select any cells that have letters in them, Excel can only plot cells with numerical entries. Remember that you are told to plot in terms of y (in this case, Force) vs. x (Radius). Graphing In the example the graph would look like this: Chart Title 0.100 0.090 0.080 0.070 0.060 0.050 0.040 0.030 0.020 0.010 0.000 0 0.05 0.1 0.15 You can go ahead and delete the chart title for now. 0.2 0.25 Graphing – Inserting Axis Titles Select the plot area. Two new tabs and “Chart Tools” will appear at the top of the page. Select “Design” and to go “Add Chart Element”. Under “Axis titles” you can add horizontal and vertical titles. Graphing – Inserting Axis Titles In this case the horizontal axis is “Radius (m)” and the vertical axis is “force (N)”. You should always add units to the titles. 0.100 0.090 0.080 Force (N) 0.070 0.060 0.050 0.040 0.030 0.020 0.010 0.000 0 0.05 0.1 0.15 Radius (m) 0.2 0.25 Graphing – Inserting Gridlines You will always want full gridlines (major & minor) on your plot. Under the “Add Chart Element” there is the option “gridlines” where you can add them. Graphing – Inserting Gridlines After you have added gridlines, your plot will look like this. 0.100 0.090 0.080 Force (N) 0.070 0.060 0.050 0.040 0.030 0.020 0.010 0.000 0 0.05 0.1 0.15 Radius (m) 0.2 0.25 Graphing – Adding a Trendline Many times when you plot your data you will want to find an equation that models the data. To add a trendline, right click on one of the points on the plot and select “Add Trendline”. Graphing – Adding a Trendline A menu will appear on the right side of the screen. ◦ You will need to choose the type of slope that best fits the plot. ◦ Also use “Display equation on chart”. ◦ Do not use the “Set Intercept” option. Graphing – Adding a Trendline You should move the equation off of the chart area so that the plot looks like this: 0.100 0.090 0.080 0.070 Force (N) 0.060 0.050 0.040 0.030 0.020 0.010 0.000 0 0.05 0.1 0.15 Radius (m) 0.2 y = 0.3912x + 0.0064 0.25 Graphing- Adding a Trendline Excel gives trendlines in terms of y vs. x because the program does not read the variables used to make the graph. You will always change the variables in the trendline equation so that it matches the axes. (ex. F = 0.3912r + 0.0064) Graphing - Background Your graphs should always have a white background. In older versions of Excel it may use a grey background on the plot as a default. This can be changed under the design tab. Finished Graph When you are done with all of the modifications then your graph should look something similar to this. 0.100 0.090 0.080 Force (N) 0.070 0.060 0.050 0.040 0.030 0.020 0.010 0.000 0 0.05 0.1 0.15 Radius (m) 0.2 F = 0.3912R + 0.0064 0.25 Microsoft Word Just like the data table, you will want to copy and paste the plot into your report. Make sure that the plot uses as much space as possible. The dimensions can be changed by clicking on a corner and dragging the image to a new size. You will ALWAYS have a title UNDERNEATH the plot. (ex. Figure 1: Centripetal force vs. the radius of the hanging mass) After the title you will add a caption that briefly discusses the results you can draw from the graph and any trends in the graph. Fin For further reference, this presentation and other materials can be found on the course website. You can get help from your lab instructor during their office hours. If you cannot make it to their office hours, then you may e-mail them and set up an appointment. Additional help can be found by going to the writing lab in Strong Hall’s Physics Library.