Matplotlib is an open source 2D plotting library for Python. It is very impressive and robust, but the API and documentation is maddeningly difficult to follow.
Here I have provided a function that will create a bar graph [as a png image] from a Python dictionary using the Matplotlib API.
It will auto-size the bars and auto-adjust the axis labels for you. All you need to pass into it is a dictionary data structure (and optionally a graph title and output name).
We start with a Python dictionary like this:
... and the function will use Matplotlib to create a graph like this:
Here is a sample script that uses my function:
enjoy.
-Corey
Copyright © 2006-2008 Corey Goldberg
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.