Probably one of the most important aspects of data science is in visualizing data. This means: to make a plot (or graph) out of it.
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. In the simplest case, a chart has two rows, one for the $x$, or horizontal axis, and one for $y$, or the vertical axis.
There is one little issue here: the sample.dat file only contains one column of numbers. What do we do about the other column? Make it up! We'll put the actual data on the y-axis, and make up the x-axis to just be the data point's position in the file (1,2,3,...)
To make the plot, we'll use drawchart which works like this:
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. Visualize your data in a graph!
Type your code here:
See your results here:
What will you fill in for the data = line, which is to read in the next number from the data file? And, if data is read in OK (in the if block), what will you set y[i] equal to (this will be what goes on the y, or vertical axis of your plot)?
Share your code
Show a friend, family member, or teacher what you've done!