def register(*dim: List[int], use_3d: bool = False, use_polar: bool = False, collection: bool = False):
    """Decorator to wrap common plotting functionality.

    Parameters
    ----------
    dim : Dimensionality of histogram for which it is applicable
    use_3d : If True, the figure will be 3D.
    use_polar : If True, the figure will be in polar coordinates.
    collection : Whether to allow histogram collections to be used
    """   
    if use_3d and use_polar:
        raise RuntimeError("Cannot have polar and 3d coordinates simultaneously.")
    
    # TODO: Add some kind of class parameter

    def decorate(function):
        types.append(function.__name__)
        dims[function.__name__] = dim

        @wraps(function)
        def f(hist, write_to: Optional[str] = None, dpi:Optional[float] = None, **kwargs):
            fig, ax = _get_axes(kwargs, use_3d=use_3d, use_polar=use_polar)

            from physt.histogram_collection import HistogramCollection
            if collection and isinstance(hist, HistogramCollection):
                title = kwargs.pop("title", hist.title)
                if not hist:
                    raise ValueError("Cannot plot empty histogram collection")
                for i, h in enumerate(hist):
                    # TODO: Add some mechanism for argument maps (like sklearn?)
                    function(h, ax=ax,  **kwargs)
                ax.legend()
                ax.set_title(title)
            else:
                function(hist, ax=ax, **kwargs)

            if write_to:
                fig = ax.figure
                fig.tight_layout()
                fig.savefig(write_to, dpi=dpi or default_dpi)
            return ax
        return f
    return decorate
Decorator to wrap common plotting functionality.

    Parameters
    ----------
    dim : Dimensionality of histogram for which it is applicable
    use_3d : If True, the figure will be 3D.
    use_polar : If True, the figure will be in polar coordinates.
    collection : Whether to allow histogram collections to be used