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)
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)
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)
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)
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
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