On Tue, Nov 18, 2008 at 4:25 AM, Mike Hansen <mhansen@...> wrote:
> What would you recommend as the best way going about this? I'm
> willing to put some work in on this. There was someone back in July
> who posted some code moving in this direction, but it didn't feel like
> it was the right way to do things. He didn't get any response from
> the list.
That was Tony's work, and it is a shame we didn't give him more
feedback. It is definitely an important enhancement. Sometimes the
things that are harder get marked with a "star" in my inbox, and the
things that are easier get tackled right away, and the harder things
get pushed down the queue. Which is why I encourage folks to make
gentle reminders: the silence is usually not lack of interest, but
lack of time.
You should start by taking a look at where Tony left off. I will
review his code too, and when we have both had a chance to digest it,
we can discuss a plan of attack.
Tony may be interested in contributing too. Reading over his email,
one of the things that stumped him was trying to get this done right
and maintain backwards compatibility. That is admirable, and we
should try to achieve that where possible, but I don't think it is a
requirement. This is a major feature enhancement, and is one of the
things that have kept me from releasing mpl as 1.0, so if we need some
breakage to get there we can live with it. Not too many people tweak
the axis layout, in part because there is not much to tweak. Also,
most use the Axes front end helper methods (eg ax.get_xticklabels())
which will insulate them from a reorg at the Axis layer.
There are two related problems here: one easier, one harder. We can
start with the easier one. The easy one is to have a "detachable
axis". Right now we have one on the right and one on the left for the
x-axis. We may as well generalize this to allow folks to have as many
as they want and put them whereever they want (center, offset farther
to the left, etc.). It would be nice to support a different set of
tick locators and formatters for each axis, eg you could have a left
axis in dollars and a right axis in euros. Note this is not the same
thing as having a different scale, in the sense of the two_scales
example, this is just two different formatting of the same scale. The
harder problem is supporting an arbitrary number of axis instances
each with its own transform, etc. Eg generalizing the two_scales
example. I suggest you punt on that one for now.
If you really want to keep this easy, you can forget all about the
locators and formatters and just focus on allowing the user to place
the axis lines wherever they want, using the standard Axis locator and
formatter for all the axis lines. That is probably the place to start
-- we can always try to beef it up later. That part should be fairly
easy. Another enhancement that would be nice would be to support a
TextCollection for the tick labels. Drawing the tick labels is
actually a pretty big bottleneck in the whole plot rendering time, and
since the properties are naturally homogeneous (eg the rotation, the
fontsize) we could probably save some time using a collection.