Пример #1
0
        def wrapper(dataset, *args, **kwargs):

            if dataset.ndim < 2:
                from spectrochempy.core.plotters.plot1d import plot_1D

                _ = kwargs.pop("method", None)
                return plot_1D(dataset, *args, method=method, **kwargs)

            if kwargs.get("use_plotly", False):
                return dataset.plotly(method=method, **kwargs)
            else:
                return getattr(dataset, f"plot_{type}")(*args,
                                                        method=method,
                                                        **kwargs)
Пример #2
0
def plot_image(dataset, **kwargs):
    """
    Plot a 2D dataset as an image plot.

    Alias of plot_2D (with `method` argument set to ``image``).
    """
    if dataset.ndim < 2:
        from spectrochempy.core.plotters.plot1d import plot_1D

        return plot_1D(dataset, **kwargs)

    kwargs['method'] = 'image'
    if kwargs.get('use_plotly', False):
        return dataset.plotly(**kwargs)
    else:
        return plot_2D(dataset, **kwargs)
Пример #3
0
def plot_map(dataset, **kwargs):
    """
    Plot a 2D dataset as a contoured map.

    Alias of plot_2D (with `method` argument set to ``map``.
    """
    if dataset.ndim < 2:
        from spectrochempy.core.plotters.plot1d import plot_1D

        return plot_1D(dataset, **kwargs)

    kwargs['method'] = 'map'
    if kwargs.get('use_plotly', False):
        return dataset.plotly(**kwargs)
    else:
        return plot_2D(dataset, **kwargs)
Пример #4
0
def plot_waterfall(dataset, **kwargs):
    """
    Plot a 2D dataset as a a 3D-waterfall plot.

    Alias of plot_2D (with `method` argument set to ``waterfall``.
    """
    if dataset.ndim < 2:
        from spectrochempy.core.plotters.plot1d import plot_1D

        return plot_1D(dataset, **kwargs)

    kwargs['method'] = 'waterfall'
    if kwargs.get('use_plotly', False):
        return dataset.plotly(**kwargs)
    else:
        return plot_2D(dataset, **kwargs)
Пример #5
0
    def _plot_generic(self, **kwargs):

        if self._squeeze_ndim == 1:

            ax = plot_1D(self, **kwargs)

        elif self._squeeze_ndim == 2:

            ax = plot_2D(self, **kwargs)

        elif self._squeeze_ndim == 3:

            ax = plot_3D(self, **kwargs)

        else:
            error_("Cannot guess an adequate plotter, nothing done!")
            return False

        return ax
Пример #6
0
    def plot_generic(self, **kwargs):
        """
        The generic plotter.

        It try to guess an adequate basic plot for the data. Other method of plotters are defined explicitely in the
        ``plotters`` package.

        Parameters
        ----------
        ax : :class:`matplotlib.axe`
            the viewplot where to plot.
        kwargs : optional additional arguments

        Returns
        -------
        ax
            Return the handler to ax where the main plot was done
        """

        if self._squeeze_ndim == 1:

            ax = plot_1D(self, **kwargs)

        elif self._squeeze_ndim == 2:

            ax = plot_2D(self, **kwargs)

        elif self._squeeze_ndim == 3:

            ax = plot_3D(self, **kwargs)

        else:
            error_('Cannot guess an adequate plotter, nothing done!')
            return False

        return ax