'Select contour levels to span the data.
We need two more levels for filled contours than for
line contours, because for the latter we need to specify
the lower and upper boundary of each range. For example,
a single contour boundary, say at z = 0, requires only
one contour line, but two filled regions, and therefore
three levels to provide boundaries for both regions.'

def _autolev(self, N):

    if (self.locator is None):
        if self.logscale:
            self.locator = ticker.LogLocator()
        else:
            self.locator = ticker.MaxNLocator((N + 1), min_n_ticks=1)
    lev = self.locator.tick_values(self.zmin, self.zmax)
    self._auto = True
    return lev
