In an elaboration of my previous post a few minutes ago about weighted

histograms:

As I see it I have three options in getting matplotlib to draw

weighted histograms:

1) Hack up the source. This is fine but I try not to do it unless I

have to.

2) Define my own function that creates the histogram, then pass it to

some convenient "Plot this as a histogram" function in matplotlib.

3) Try to "force" matplotlib to do what I want be explicitly modifying

its namespace. I do this routinely to add functionality that I

consider to be missing from the packages that I use without

maintaining a local branch of the source. Here's one example:

## ···

############################

# Add some stuff to the scipy namespace

import scipy

def lrange(l, h, dex):

"""Log-spaced array"""

return 10**arange(log10(l), log10(h), dex)

scipy.lrange = lrange

In this case I would do something like define my_make_hist() and

my_draw_hist() to do what I want, and then force them into the

matplotlib namespace with:

matplotlib.matlab.hist = my_plot_hist

matplotlib.mlab.hist = my_make_hist

Unfortunately the call to gca() in matplotlib.matlab.hist() seems to

prevent this from working the way I want it to.

So, option 1 is unpalateable but possible, option 2 is out b/c

matplotlib seems to lack such a function, and option 3 is out b/c

matplotlib isn't resolving the function references the way I would

like.

So, I guess the question is does anyone know any neat tricks to get

this to work?

Thanks a bunch,

Greg