Get factors for categorical axes.

def _get_factors(self, element):
        """
        Get factors for categorical axes.
        """
        gdim = None
        sdim = None
        if element.ndims == 1:
            pass
        elif not (self.stacked or self.stack_index):
            gdim = element.get_dimension(1)
        else:
            sdim = element.get_dimension(1)

        xdim, ydim = element.dimensions()[:2]
        xvals = element.dimension_values(0, False)
        xvals = [x if xvals.dtype.kind in 'SU' else xdim.pprint_value(x)
                 for x in xvals]
        if gdim and not sdim:
            gvals = element.dimension_values(gdim, False)
            xvals = sorted([(x, g) for x in xvals for g in gvals])
            is_str = gvals.dtype.kind in 'SU'
            xvals = [(x, g if is_str else gdim.pprint_value(g)) for (x, g) in xvals]
        coords = xvals, []
        if self.invert_axes: coords = coords[::-1]
        return coords