Lesson goal: Plot an array of data

Previous: Make a Chart | Home | Next: Introduction to data files

In this lesson, you can interface to Google Charts to create a nice looking plot of a mathematical function. In order to do this, you have to fill two arrays with the $(x,y)$ pairs that you want to plot. Once done, pass these two arrays to the plot function described here, and you'll see a professional-looking plot of your arrays.
Move the mouse over a dotted box for more information.

Remember, the plot will appear at the bottom of the browser window. You might have to scroll down to see it.

Now you try. Finish the x[i]= and y[i]= lines with the x and y points that you wish to plot.

Type your code here:

See your results here:

This code will not run! You have to finish the x[i]= line with the point-by-point x-coordinates you wish to plot. Next, you have to finish the y[i]= line with the point-by-point y-coordinates you wish to plot. Dismiss.
Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.