MatplotLib graphs

Can I use matplotlib to generate graphs from my data?

Yes you can, and your graphs will be saved as an image file in your directory.

The block of code below gives you an example of how you would do this:

import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(100))

fig.savefig("graph.png")

graph.png will then show up in your home directory. Simply put, wherever you might normally use plt.show() to display your graph on screen you should use fig.savefig('your_graph.png') to save it as an image file instead.

Once you've done that, you can view the graph from your browser using a URL like this: http://www.pythonanywhere.com/user/your-username/files/home/your-username/graph.png