How to get correct xtick labels with zooming and panning

Hi,

If I create a bar graph inside a FigureCanvas, how do I get the correct x tick labels to display when someone does a zoom with the NavigationToolbar?

For example, lets say I’ve got the below code:

    *self*.axes.set_xticks = range(len(vals))

    *self*.axes.set_xticklabels(*xLabels*)

    *self*.axes.bar(

        left=range(len(vals)),

        height=map(float, vals),

        width=.2,

        align=*'center'*,

        alpha=0.44,

        picker=5)

If the number of values is very large, then matplotlib seems to select only a few x labels to display (selecting far left and right, and some in the middle), but it’s choosing the first ones in the specified label array, instead of indexing into it.

I’ve tried setting the tick labels, based on the ticks it’s selected, (setting labels based on the ticks after the bar has been created) and that seems to work on the initial load, but then if someone zooms into a particular part, it doesn’t update the labels to the correct range … It’s almost like I would need a callback to reset the labels …

Ideas?

Cheers,

Lars