Eric Firing wrote:
Even without the automatic-redraw difference, the OO interface requires more typing, and more mental record-keeping, than the pylab interface.
Yes, but I don't think that's inherent in an OO interface, it's just that the quickie utilities are missing from the current OO interface.
oh, and it's not mental record keeping -- it's explicit record keeping, which is why I like it:
F1 = OOlab.Figure()
F2 = OOlab.Figure()
Isn't that better than trying to remember which is the current figure?
Typing "plot(x,y)" is easier to do and remember than creating a figure, adding axes, and then typing "ax1.plot(x,y)".
Why couldn't plot(x,y) create and return a figure object? Or an axis object? -- I haven't thought it out too much yet.
> For interactive use, I really don't see any advantage to an OO interface.
Well, for *just* interactive use, I agree, but I see some very large advantages to an OO style for embedding in programs and larger projects. However, I don't want to use one style for one use, and a different style for another.
Part of this might be from my style -- I actually found that I didn't make much use of interactive mode in Matlab -- and I was a heavy Matlab user -- six years of grad school and a dissertation's worth.
As handy as it is to have a command line to play with, if I'm writing more than four or five lines (and I usually am!), I'm happier putting them in a file and running them as a script. Even in that case, I don't mind a little extra typing.
What I'm envisioning for "OOlab" is a set of utility functions that do make some of the pylab stuff easy -- not well thought out yet, but something like:
F = ooLab.figure(1) # I often need to plot more than one figure anyway, so I don't mind having to type that.
ax = F.plot(x,y) # there could be this and subplot
ax.set_title = "A title for the plot"
# or better yet: ax.title = "A title for the plot"
# I'd like to see more properties in MPL too!
ax.grid(True)
.
Whatever.
Note that some of this comes from my love of namespaces -- I really don't like "import*" -- the way that can work is using more OO, so you don't need to type the module name everywhere.
I don't see much advantage to keeping the idea of a "current figure" or "current axis" -- it's just not that hard to keep a reference. Maybe it does help for quickie command line stuff, but I think for even quickie scripts, it's clearer to name your axes, etc.
However, the proof is in the pudding -- what needs to be done is for someone to sit down and start using MPL in interactive/quickie script use without pylab, and write something for OOlab whenever something is harder to do than it should be. Then we'll see how it works out.
I'd like that person to be me, but I actually haven't been using MPL for much lately, and the little I am has been embedded in a wxPython app.
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@...259...