'Update ticks (position and labels) using the current data
interval of the axes. Returns a list of ticks that will be
drawn.'

def _update_ticks(self, renderer):

    interval = self.get_view_interval()
    tick_tups = list(self.iter_ticks())
    if (self._smart_bounds and tick_tups):
        (view_low, view_high) = sorted(interval)
        (data_low, data_high) = sorted(self.get_data_interval())
        locs = np.sort([ti[1] for ti in tick_tups])
        if (data_low <= view_low):
            ilow = view_low
        else:
            good_locs = locs[(locs <= data_low)]
            if len(good_locs):
                ilow = good_locs[(-1)]
            else:
                ilow = locs[0]
        if (data_high >= view_high):
            ihigh = view_high
        else:
            good_locs = locs[(locs >= data_high)]
            if len(good_locs):
                ihigh = good_locs[0]
            else:
                ihigh = locs[(-1)]
        tick_tups = [ti for ti in tick_tups if (ilow <= ti[1] <= ihigh)]
    if (interval[0] <= interval[1]):
        interval_expanded = interval
    else:
        interval_expanded = (interval[1], interval[0])
    if hasattr(self, u'_get_pixel_distance_along_axis'):
        with np.errstate(invalid=u'ignore'):
            try:
                ds1 = self._get_pixel_distance_along_axis(interval_expanded[0], (-0.5))
            except:
                warnings.warn(u'Unable    to    find    pixel    distance    along    axis    for    interval    padding    of    ticks;    assuming    no    interval    padding    needed.')
                ds1 = 0.0
            if np.isnan(ds1):
                ds1 = 0.0
            try:
                ds2 = self._get_pixel_distance_along_axis(interval_expanded[1], (+ 0.5))
            except:
                warnings.warn(u'Unable    to    find    pixel    distance    along    axis    for    interval    padding    of    ticks;    assuming    no    interval    padding    needed.')
                ds2 = 0.0
            if np.isnan(ds2):
                ds2 = 0.0
        interval_expanded = ((interval_expanded[0] - ds1), (interval_expanded[1] + ds2))
    ticks_to_draw = []
    for (tick, loc, label) in tick_tups:
        if (tick is None):
            continue
        if (not mtransforms.interval_contains(interval_expanded, loc)):
            continue
        tick.update_position(loc)
        tick.set_label1(label)
        tick.set_label2(label)
        ticks_to_draw.append(tick)
    return ticks_to_draw
