On Wed, Apr 8, 2009 at 7:33 AM, Ryan May <rmay31@gmail.com> wrote:

import matplotlib.ticker as mticker

def minsec(sec, unused):
    minutes = sec // 60
    sec = sec - minutes * 60
    return '%d:%02d' % (minutes, sec)

locator = mticker.MultipleLocator(60)
formatter = mticker.FuncFormatter(minsec)

Ryan


This is exactly what I was looking for...thank you!  With this example (and the docs) I finally understand how the Locator and Formatter classes work.  Now, I just can do this:

        locator = mticker.MultipleLocator(60)
        formatter = mticker.FuncFormatter(lambda x, y: '%02d:%02d' % divmod(x, 60))

        self.ax.xaxis.set_major_locator(locator)
        self.ax.xaxis.set_major_formatter(formatter)

Thanks again,
BZ