Thanks for the detailed reply. I was just wondering whether I was missing something obvious and
that doesn't seem to be the case.

Cheers

Daniel Wheeler

On Aug 2, 2006, at 2:15 PM, John Hunter wrote:

"Daniel" == Daniel Wheeler <daniel.wheeler@nist.gov> writes:

    Daniel>    It seems that resetting the axes limits every time data
    Daniel> needs to be redisplayed is rather inefficient.  A script
    Daniel> is included with this mail that tests the efficiency of
    Daniel> resizing the y axis.  The script has two loops, in the
    Daniel> first loop pylab.ylim() is continuously called with the
    Daniel> changing size of the domain, in the second loop
    Daniel> pylab.ylim() is not called inside the loop. The first loop
    Daniel> takes roughly twice as long to perform.  Is this an
    Daniel> unavoidable cost for resizing the y axis or is there
    Daniel> another way to resize the axis that is less costly than
    Daniel> using ylim()?

The cost from the tick layout and formatting -- this could be made
more efficient but that is where the cost is currently.  For every
tick label, matplotlib does a layout assuming you may have passed a
rotated multiline string.  Special casing the no newline, non-rotated
case is probably where the biggest win would come from.  It is
a good project for someone to tackle, but the text layout code is kind
of hairy because it deals with so many cases: mathtext, usetex,
rotated strings, multiline strings, top/bottom left/right alignment,
and so on.

A complete refactoring of ticks to treat them as a single
collection-like object rather than a bunch of independent objects
would also help a lot here.

JDH


Daniel Wheeler