>>>>> "Thomas" == Thomas Guettler <gu*****@thom as-guettler.de> writes:
Thomas> Hi! I need to create some simple charts with python. A
Thomas> list contains integers between 0 and mymax.
Thomas> I want to see how the values are distributed (How many are
Thomas> 0, how many are mymax, ...). The result should be a small
Thomas> (200x200) png file.
Thomas> matplotlib: Too much gtk binding (I only need a png) -
The web page may have given this impression, but it's not correct.
matplotlib is totally independent of GTK. It *can* render to GTK, but
it isn't required. GTK was the first matplotlib backend and perhaps
this is why is gets so much prominence on the web page. But now you
can use it with GTK, WX or Tk, or none of the above to simply generate
PNG or PS figures.
To render to PNG w/o a GUI, use the antigrain (agg) backend as
described at
http://matplotlib.sourceforge.net/backends.html#Agg.
Basically, you just need
* Download the src distribution, edit setup.py and set BUILD_AGG =
True, do a normal setup.py install.
* Edit the config file to make agg your default backend by setting
backend : Agg
in your matplotlibrc file; see
http://matplotlib.sourceforge.net/.matplotlibrc. This file should
be placed in your HOME dir.
Then you can make your small histogram figure as follows
from matplotlib.matl ab import *
x = someInts # your data here
hist(x, 100) # 100 is the number of histogram bins
savefig('myfig. png', figsize=(4,4)) # figsize in inches
Hope this helps,
John Hunter