def _get_factors(self, element):
        """
        Get factors for categorical axes.
        """
        if not element.kdims:
            xfactors, yfactors = [element.label], []
        else:
            factors = [key for key in element.groupby(element.kdims).data.keys()]
            if element.ndims > 1:
                factors = sorted(factors)
            factors = [tuple(d.pprint_value(k) for d, k in zip(element.kdims, key))
                       for key in factors]
            factors = [f[0] if len(f) == 1 else f for f in factors]
            xfactors, yfactors = factors, []
        return (yfactors, xfactors) if self.invert_axes else (xfactors, yfactors)