[[File:grid.png|right|300px]]
Very nice site!
== Project ==
Very nice site!
Learn how to plot data with the matplotlib plotting library. Ditch Excel forever!
Very nice site!
== Goals ==
* practice reading data from a file
* practice using the matplotlib Python plotting library to analyze data and generate graphs
== Project setup ==
=== 1. Install the project dependencies ===
Installing matplotlib is unfortunately rather complicated on OSX and Windows. Please ask for help if you get stuck or don't know where to start!
First, install <code>numpy</code>. On Linux, you can use your package manager to install the <code>python-numpy</code> package. On Windows and OSX, you can download the appropriate binary from http://sourceforge.net/projects/numpy/files/NumPy/1.7.1/.
Then, install <code>matplotlib</code>. On Linux, you can use your package manager to install the <code>python-matplotlib</code> package. On Windows and OSX, you can download the appropriate binary from https://github.com/matplotlib/matplotlib/downloads/.
If either of these installs fails, fear not! Wave over a staff member and we'll help.
=== 2. Download and un-archive the Matplotlib project skeleton code ===
* http://web.mit.edu/jesstess/www/IntermediatePythonWorkshop/Matplotlib.zip
Un-archiving will produce a <code>Matplotlib</code> folder containing several Python and text files.
=== 3. Test your setup ===
Run the <code>basic_plot.py</code> script in your <code>Matplotlib</code> directory. A window with a graph should pop up.
== Project steps ==
<pre>pyplot.plot([0, 2, 4, 8, 16, 32], "o-")</pre>
and re-run the script. What changed?
</li>
<li>
y_values = [0, 2, 4, 8, 16, 32]
pyplot.plot(x_values, y_values, "o-")</pre>
and re-run the script. What changed?
Note how matplotlib automatically resizes the graph to fit all of the points in the figure for you.
* What does matplotlib pick as the x values if you don't supply them yourself?
* What options would you pass to <code>pyplot.plot</code> to generate a plot with red triangles and dotted lines?
=== 2. Plotting the world population over time ===
|