Labelling and saving your first Python plot
The last tutorial covered how to load a dataset into your python session and then plot it using the matplotlib.pyplot (pylab) plotting package. Well done if you have gotten this far! This screencast will show you how to label axes, add a grid to your plot, configure the visible data range on the x and y axis and, of course how to save your very first plot in Python. New commands in this screencast include: pylab.xlim, pylab.ylim, pylab.xlabel, pylab.title, pylab.savefig and pylab.grid. Look them up in the help menu within the terminal by adding a ‘?’ after the command or look up a more detailed tutorial on the matplotlib.pylplot web page.
Other sites with useful information include this site which has a step-by-step pictorial tutorial on a similar example to what I have covered in this tutorial and the last one. The site also has a small cheat sheet on the shortcuts for line, colour and marker styles. For those wanting to add errorbars to their data see this wonderful post.
Post contributed by Shrividya Ravi, VUW