Hello,
I'm thinking about slightly modifying the draw() method of the Axes
class, so that user can optionally
calculate the position of the axes at drawing time. It may be
considered as a general version of the apply_aspect() method.
For example, instead of "self.apply_aspect()" call in the draw
function, we may put something like below.
if self._axes_locator:
self._axes_locator(self, renderer)
else:
self.apply_aspect()
where self._axes_locator is a (user-supplied) callable object which
takes the axes itself and the renderer as arguments.
I have been running a similar version of this, and I found it quite
helpful especially when drawing images. Here are a few of my use
cases.
* colorbar (or any kind of axes) whose location is adjusted to match
the image location (which is calculated on the fly with apply_aspect).
* grid of images (of same size) with fixed space between them.
I guess the needed change is not significant and I don't think it will
interfere with other things of Axes class.
So, how do others think?
Regards,
-JJ
As there was no explicit objection, I just submit this to the trunk.
The change in Axes class is rather minor, and I hope others don't
mind.
I added two examples. The examples are rather lengthy, because they
are actually helper classes that I have been playing with (and it is
not well documented).
Here is screenshots.
http://dl.getdropbox.com/u/178748/mpl_aux/axes_divider.png
http://dl.getdropbox.com/u/178748/mpl_aux/axes_grid.png
I hope others find this useful.
Regards,
-JJ
···
On Wed, Dec 17, 2008 at 1:06 AM, Jae-Joon Lee <lee.j.joon@...149...> wrote:
Hello,
I'm thinking about slightly modifying the draw() method of the Axes
class, so that user can optionally
calculate the position of the axes at drawing time. It may be
considered as a general version of the apply_aspect() method.
For example, instead of "self.apply_aspect()" call in the draw
function, we may put something like below.
if self._axes_locator:
self._axes_locator(self, renderer)
else:
self.apply_aspect()
where self._axes_locator is a (user-supplied) callable object which
takes the axes itself and the renderer as arguments.
I have been running a similar version of this, and I found it quite
helpful especially when drawing images. Here are a few of my use
cases.
* colorbar (or any kind of axes) whose location is adjusted to match
the image location (which is calculated on the fly with apply_aspect).
* grid of images (of same size) with fixed space between them.
I guess the needed change is not significant and I don't think it will
interfere with other things of Axes class.
So, how do others think?
Regards,
-JJ