From: John H. <jdh...@ac...> - 2003-12-12 13:38:55
|
>>>>> "K" == K KISHIMOTO <ko...@us...> writes: K> Hi, I'm using matplotlib for my scientific analysis, and K> charmed by It's function. Thanks! K> Because I often use another tools for data histograming, I K> think it's convenient if matplotlib could plot already K> histogramed data more efficiently. This seems like the kind of thing that would best be done in your user library. Eg, if you make a module mymatplotlib.py, you can defined your own hist. In that file, just import matplotlib.matlab and call matplotlib.matlab.hist within it. In fact, matplotlib.matlab.hist calls matplotlib.mlab.hist. On an unrelated topic: def hist(x, bins=10, noplot=0, normed=0, weights=[], errors=[]) Just wanted to point out that this is a potential gotcha in python. For example, what do you expect the output of this code to be? def func1(x=[]): if not len(x): x.append(1) print x def func2(y=[]): if len(y)<2: y.append(2) print y z = [] func1(z) func2(z) The standard way to pass empty lists as default function args is to do: def func1(x=None): if x is None: x = [] #blah blah Lists and dicts are different in this capacity than strings or ints because the can be changed (mutable). Thanks for your suggestions, John Hunter |