'select a suitable locator'

def _select_locator(self, formatter):

    if (self.boundaries is None):
        if isinstance(self.norm, colors.NoNorm):
            nv = len(self._values)
            base = (1 + int((nv / 10)))
            locator = ticker.IndexLocator(base=base, offset=0)
        elif isinstance(self.norm, colors.BoundaryNorm):
            b = self.norm.boundaries
            locator = ticker.FixedLocator(b, nbins=10)
        elif isinstance(self.norm, colors.LogNorm):
            locator = ticker.LogLocator()
        else:
            locator = ticker.MaxNLocator(nbins=5)
    else:
        b = self._boundaries[self._inside]
        locator = ticker.FixedLocator(b)
    self.cbar_axis.set_major_locator(locator)
