Visualizing data is one of the most important aspects of data science. This makes it easy for you (or your boss!) to see trends in data, that would be hard to see in just a list of numbers. Visualizing likely means making a graph (or plot) out of some data. Let's make a plot of the CO$_2$ data here.
Since charts are made of rows of data, arrays will be a natural way of holding and presenting your data to the chart drawing function. Thus, our job is to get the numbers from the data file co2.csv into two arrays; one array for the $x$ or horizontal axis, and one array for the $y$ or vertical axis.
We'll send these two arrays to drawchart as described here:
Move the mouse over a dotted box for more information.
A chart will always appear at the very bottom of the browser window. You might have to scroll down to see it.
Now you try. Finish the code and make a graph of CO2 concentration over the years.
Type your code here:
See your results here:
The code won't run, but here is our logic:
line is the next line of data from the file. It'll be something like 1958,316.
What will you put into the explode(??) function to explode line at its comma?
How will you assign year[i] and co2[i]? See the hints if you get stuck.
When you get it to work, Google "Keeling Curve" to see if your graph looks correct.
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:
Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.
Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into
Then click the "Use on iPhone" button that you'll see.