However, John's version is pretty nice too:
> fig = pylab.figure(1) ax = fig.add_subplot(111,
> xlim=(-0.25,2.0), ylim=(0.0,1.3), aspect=('scaled',
> True), autoscale_on=False) ax.plot((0,.2,.3,.4,1.5),
> keyword arguments are very pythonic!
The downside of having to use kwargs like this is that you have to
know about them in advance.
We could support
ax.xlim = 0,1
Simply by defining the appropriate __getattr__ and __setattr__
functions with the existing code base in just a few lines of code.
There would be a couple of cases where we might see some name clashes
but there wouldn't be many, and we could easily fix these and
deprecate the old usage.
If you want to take a stab at this, I think it would be preferable
to writing "another interface". Better to improve the OO interface we
The heavy reliance on setters and getters dates to the fact that I was
a C++ programmer before I was a python programmer, and I wrote
matplotlib fairly early into my diving into python. I started writing
it around python2.1 and python properties were not yet part of the
language. So historically that is why we have our own hacked up
version of properties based on these setters and getters. Since there
is a lot of code built around them at this point (particularly for
those doing a lot of OO matplotlib including yours truly) I am
hesitant to completely break it.
We have talked many times about doing something different, namely we
came very close to using enthought traits at one point, but hesitated
to pull the final trigger because they hadn't publicly released it and
there was no public user base so we weren't sure what the support
would be going forward. There has now been a public release but as
far as I know no widespread community adoption yet.
My inclination at this point is to take the path of least resistance
and simply make properties out of the existing setters and getters. I
think we could use python properties for this or do our own
getattr/setattr magic. I would also be amenable to using traits.