preliminary detachable axis patch

So... any takers at performing open-heart surgery on

    > matplotlib and replacing several of the most critical
    > parts with (Trait-based) replacements? (C'mon, John, this
    > should be easy for neuro-surgery types! :slight_smile: Or should I
    > press ahead with the dumb version? ("If you're gonna be
    > dumb, you gotta be tough")

    > Any other comments/questions?

I wonder if the current design of an Axis containing a list of ticks
is the best one. Eg, in the current design each xticklabel can have
it's own color, own y position and own rotation. In real life these
attributes should be shared, or should be a property of the xaxis.
But rather than refactor this containment relationship which is
documented and is used external code, your idea to use traits is
probably the right way. Eg, this is a natural place for delegation --
eg the tick line and label locations should delegate to an axis trait.

The rate-limiting step here has not been the application of traits to
matplotlib, it is getting the latest traits package out of the
envisage tree. I spent some time working on this this morning, and
succeeded in getting the core traits minus the UI component as a
standalone package using plain-ol distutils rather than
scipy_distutils. I put the tarball here

  http://jdh.uchicago.edu/share/traits2-1.0.2.tar.gz

if you want to play with it. Also, Abraham, you may want to see if
you can get your config file stuff working with this core. I think
now is a good time to introduce traits into matplotlib. I'll probably
roll out 0.72 tomorrow, and am pretty busy this week with real work,
but then we can look into porting all mpl properties to traits. A
good start would be for you and Abraham to break the ground in your
respective patches and test my traits port.

I posted my port to envisage-dev -- I had to make only a few minor
changes to the traits src to get this to work under python2.2 and to
work w/o the UI package. I suspect there will be a number of
iterations before we can get a package fully synchronized with
enthought traits, but my guess is that this will not be too long since
they seem receptive to making traits more accessible. Robert Kern had
the good idea of providing a null UI interface so that the existing
code which uses the UI component would not have to be altered.

Let me know how it goes...

JDH

John Hunter wrote:

I'll probably
roll out 0.72 tomorrow...

Any idea when anonymous CVS from Sourceforge for projects beginning with m might be available again? I was hoping you might have "inside information." At the moment, it _looks_ like it's working, but in fact an apparently successful CVS checkout gets 0.72 as of 9 February.

Steve

JDH wrote:

I think now is a good time to introduce traits into matplotlib.

The online documentation for traits seems pretty sparse. Here's the best I could track down, Dave Morrill's scipy '04 lightning talk: http://www.scipy.org/wikis/scipy04/presentations2004/scipy_conference_2004.pdf

The gist is encapsulated in the following basic usage example. Whee, what fun, strong types with notification in Python!

import traits2

class Person(traits2.HasTraits):
     weight = traits2.Float
     volume = traits2.Range(0.0, 11.0, default=5.0)
     stock = traits2.Trait(None, 0, 1, 2, 3, 'many') # enumerated list
     name = traits2.Str
     # method signatures not included in this example...

joe = Person()
joe.weight = 120.0

def joes_weight_changed( what, new ):
     print what, 'changed to', new

joe.on_trait_change( joes_weight_changed, 'weight' )
joe.weight = 200.0