On 2011-12-07 19:31, Christopher Spears wrote:
I do need to be able to save the chart as an image file, so it can be
linked to the wiki.  My only complaint about matplotlib is that I
have not figured out a way to save a graph as an image using a python
script.

You can save a graph with "matplotlib.plot.savefig()":

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plot
>>> fig = plot.figure(figsize=(8,8))
>>> ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
>>> pie_chart = ax.pie([10, 20, 30, 40])
>>> fig.savefig("piechart.png")

More about "savefig()" in the documentation:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.savefig

Bye, Andreas
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to