Dept. Logo

Main   |   PHY 121   |   PHY 122   |   PHY 133   |   PHY 134

TABLE OF CONTENTS
Overview

In this class, the task of making plots serves two roles simultaneously.

The first is that it is how we fit models to our data. This will largely be done implicitly by the tools provided, although you have to understand what they are giving you.

The second is to visualize and communicate our data. This is your responsibility.

Back to Top
Using the Plotting Tool

The first step is to travel to the plotting tool corresponding to your course: PHY121/122 or PHY133/134. (They have slightly different data-fitting algorithms.)

Manual interface:

The first thing you are confronted with upon traveling to either page is the "manual interface." This is the simplest way to fit the data, and you proceed as follows:

  1. Decide which quantity goes on each axis. (You can change this later.)
  2. Write a title and axis labels that makes sense given that axis orientation, in the appropriate boxes.
  3. Determine if you need error bars on each axis, and select the appropriate option from the drop-down.
  4. Determine if you want to fit the plot through the origin, and choose the appropriate option from that drop-down.
  5. Enter your data (and error bars) in the boxes given. [If you have more than 20 data points, this tool will not work for your purposes.]
  6. Click "Make the plot!"

Your plot should now pop up in a new tab, as an image that you can copy and paste into your main document. If results are not what you expect, read any warning or error messages that pop up and the "Plotting Tool FAQ" (lower on the Plotting Tool page).

If you realize that you want to swap your axes, there is a convenient button to do that with everything (axis labels, error bar choices, axis ranges, data, and error bars). There are also buttons to do so just for data (without uncertainties) and just for uncertainties, in case they're useful.

Google Sheets Interface:

If you would rather not re-enter your data, there is a way to use a spreadsheet as an input to the plotting tool instead, provided it is in a very specific format.

Open the linked spreadsheet template, and make a copy of it (as you would with a data sheet for one of the labs).

Then, on your copy, fill out the relevant information. For your data, you can copy and paste from another Google sheet or Excel document, provided you use "Ctrl-Shift-V" instead of "Ctrl-V" to paste just the values and not formulas (or right click, and select "Paste Values Only" under "Paste Special").

The "data" section only extends down so far, but you can actually ignore that - the plotting tool will work with more rows if you need them (provided not too outrageously many).

You then take this filled-out form, and click "File>Download as>Comma-separated values (.csv, current sheet)" to download the file in a form that the program can process. Then go back to the plotting tool, click "Choose File" and upload it, and click "Make the plot!"

As before, it should open up in a new tab for your to check. In this case, if you need to make edits, you can just edit your spreadsheet and re-download. You can also edit the CSV file directly if you like, depending on the nature of the edit.

The nice added benefit here (aside from being able to copy-paste data) is that you'll have the spreadsheet saved to your Google Drive, so you can edit it later if you realize you made a mistake (without needing to type everything out again).

Back to Top
Good Plotting Style

As a general rule, someone reading what you write will probably be skimming and looking for important points. As such, they will often end up looking at your plots without having carefully read the rest of your paper.

Therefore, as much as reasonable, it is important to make sure that your plot communicates what it is supposed to without requiring the support of your main text. To that end, make sure your plot has the following:

  • Title: Your title should describe exactly what is plotted on both axes and in what context the measurements constituting the plot were taken. Some examples of titles of varying qualities (for the same hypothetical plot):
    • "v vs. t": Terrible. What is v? What is t?
    • "Velocity vs. time graph": still bad. Velocity of what? What does this physically represent?
    • "Velocity of a ball rolling down a hill vs. time": Generally, good. I know understand what is represented on both axes of the graph and can imagine the scenario under which these variables were taken. Still room for improvement.
    • "Velocity of a ball rolling down a 15 degree incline vs. time": Excellent. You’ve told me not only the quantities plotted and the scenario, but the relevant physical parameters of the scenario. This is what you should ideally be aiming for.
    • "Velocity of a 0.5cm-radius iron ball rolling down a 15 degree wooden incline placed in a lab on floor A of the physics building at Stony Brook after being released from rest by...": Going overboard. There is information here that is not immediately relevant to your measurement, which it prevents me from easily extracting the information I want.
  • Axis labels: should describe the quantity you are plotting (in full words!) and include units.
  • Error bars: You need to indicate what the uncertainties on your measurements are, if they are high enough to be relevant.
  • Data points: Obviously, this is generally automatic, but make sure they all are visible on the plot (tweak the range if you have to). If you plot in Excel (not recommended), make sure you choose a scatter plot and not a "line plot."
  • Trendline: A line of best fit, indicating the conclusion we drew from the data. Again, although the plotting tool should handle this automatically, make sure it's visible (if it's not, usually there's a data entry error somewhere).

Generally, when it comes to style, the plotting tool will make everything look fine, and your job is just to enter reasonable a good title and axis labels. It is still worth looking in case something goes awry, however (and if you opt not to use the plotting tool for some reason, you will probably have more work to do).

Back to Top
Understanding and Extracting Information from Fits

Suppose you are plotting a variable \(y\) against a variable \(x\) using the plotting tool. The tool will give you a relationship of the form \(y=Ax+B\) (potentially with \(B=0\), if you fit through the origin).

In order for it to make sense to do that, you have to know that the relationship between \(y\) and \(x\) "should" be a line. That means you have to have some physics-based reason to think that an equation of the form \(y=(\dots)x+(\dots)\) holds.

Let's suppose, for sake of argument, your theoretical relationship asserts that \(y=\frac{abc}{d}x+ef\), where \(a\)-\(f\) are a bunch of other physical quantities that are constant throughout our experiment.

Then, for both \(y=Ax+B\) (the relationship we measured experimentally) and \(y=\frac{abc}{d}x+ef\) to hold, then those to equations - and in particular, the numbers in them - must be the same.

Therefore, by "matching" the pieces, we get two equations: \(A=\frac{abc}{d}\) and \(B=ef\). These are what is required for both the experimental relationship and the theoretical relationship to hold.

Then, you can take those equations, and rearrange them to calculate quantities of interest. E.g., if we had measured \(a\), \(c\) and \(d\), we could rearrange and find \(b=\frac{Ad}{ac}\), calculate \(b\), and propagate error accordingly.

In principle, there's nothing special in this about a line - if you had a way to determine the theoretical relationship and the experimental "best fit," this "matching coefficient" method would always work. The theoretical obstruction you begin to run into, however, is that determing the best fit becomes increasingly difficult with more complicated models. Thus, we (usually) stick with linear fits in this class.

Back to Top