Re: [Matplotlib-users] pylab set function in python 2.4

 Re: [Matplotlib-users] pylab set function in python 2.4 From: John Hunter - 2005-05-23 15:03:59 ```>>>>> "Chris" == Chris Barker writes: Chris> Fernando Perez wrote: >> I'd also suggest removing from all example code 'from pylab >> import *' statements. Chris> Here here! (hear hear?). I'd really like to see all those Chris> "import *"'s go away. I have no problem with this. I think we should agree on a standard way of writing examples. I'm of two minds about how we should do this vis-a-vis numerix symbols. Approach 1: Help educate newbies about where symbols are coming from import pylab as p import matplotlib.numerix as nx x = nx.arange(100.0) y = nx.sin(2*nx.pi*x) p.plot(x,y) p.show() Approach 2: Given that the array packages are still being reorganized, use pylab as a namespace aggregator import pylab as p x = p.arange(100.0) y = p.sin(2*nx.pi*x) p.plot(x,y) p.show() 1 looks better to me for the standard symbols (arange, pi, etc...) but when you start to include linear algebra, FFT, MLab, etc, I am not sure. Currently mpl numerix uses the numarray hierarchy: is there any advanced word on whether this will be used in Numeric3? import matplotlib.numeric.fft as nxfft import matplotlib.numeric.mlab as nxmlab ??? Basically, the question is, do we want to encourage using pylab as a namespace aggregator to hide the complexity of where all these symbols are coming from in packages whose organization is still evolving? Also, I still want to support the 'from somewhere import something' style of import since I think it makes the scripts more friendly to read for many from a procedural programming background.. from pylab import hist, show Chris> One way to get there is to add much of the functionality of Chris> pylab to the OO interface. I really wish I had the time to Chris> write an OO-pylab, I think it would be really great, even Chris> for interactive use. I think the OO interface is already pretty easy to use. Some ease of use areas I see are * Easier attribute setting (eg x.facecolor = 'r') but this is already accomplished somewhat since the set/get introspection facilities are now available in matplotlib.artist to the OO user * Have some way to enable auto-redraw on attribute change for interactive use. This could be accomplished fairly easily with an ipython hook * Make the backend figure canvas, figure import a little less wordy, Are there other areas you would like to see improved? There isn't a lot pylab does anymore, except manage the figure windows. And usually the API developer wants to do this in any case. JDH ```