MATPLOTLIBSpectrumPlot#

class pyopenms_viz._matplotlib.MATPLOTLIBSpectrumPlot(data: ~pandas.core.frame.DataFrame, x: str, y: str, reference_spectrum: ~pandas.core.frame.DataFrame | None = None, mirror_spectrum: bool = False, relative_intensity: bool = False, bin_peaks: ~typing.Literal['auto'] | bool = False, bin_method: ~typing.Literal['none', 'sturges', 'freedman-diaconis', 'mz-tol-bin'] = 'mz-tol-bin', num_x_bins: int = 50, mz_tol: ~typing.Literal[<class 'float'>, 'freedman-diaconis', '1pct-diff'] = '1pct-diff', aggregation_method: ~typing.Literal['mean', 'sum', 'max'] = 'max', peak_color: str | None = None, annotate_top_n_peaks: int | None | ~typing.Literal['all'] = 5, annotate_mz: bool = True, ion_annotation: str | None = None, sequence_annotation: str | None = None, custom_annotation: str | None = None, annotation_color: str | None = None, **kwargs)#

Bases: MATPLOTLIB_MSPlot, SpectrumPlot

Class for assembling a matplotlib spectrum plot

Plot method for creating plots from a Pandas DataFrame.

Parameters:
  • data (pandas.DataFrame or numpy.ndarray) – The data to be plotted.

  • x (str or None, optional) – The column name for the x-axis data.

  • y (str or None, optional) – The column name for the y-axis data.

  • z (str or None, optional) – The column name for the z-axis data (for 3D plots).

  • kind (str, optional) – The kind of plot to create. One of: (‘line’, ‘vline’, ‘scatter’, ‘chromatogram’, ‘mobilogram’, ‘spectrum’, ‘peakmap’)

  • by (str or None, optional) – Column in the DataFrame to group by.

  • relative_intensity (bool, default False) – Whether to use relative intensity for the y-axis.

  • subplots (bool or None, optional) – Whether to create separate subplots for each column.

  • sharex (bool or None, optional) – Whether to share x or y axes among subplots.

  • sharey (bool or None, optional) – Whether to share x or y axes among subplots.

  • height (int or None, optional) – The height and width of the figure in pixels.

  • width (int or None, optional) – The height and width of the figure in pixels.

  • grid (bool or None, optional) – Whether to show the grid on the plot.

  • toolbar_location (str or None, optional) – The location of the toolbar (e.g., ‘above’, ‘below’, ‘left’, ‘right’).

  • fig (figure or None, optional) – An existing figure object to plot on.

  • title (str or None, optional) – The title of the plot.

  • xlabel (str or None, optional) – Labels for the x and y axes.

  • ylabel (str or None, optional) – Labels for the x and y axes.

  • x_axis_location (str or None, optional) – The location of the x and y axes (e.g., ‘bottom’, ‘top’, ‘left’, ‘right’).

  • y_axis_location (str or None, optional) – The location of the x and y axes (e.g., ‘bottom’, ‘top’, ‘left’, ‘right’).

  • line_type (str or None, optional) – The type of line to use (e.g., ‘solid’, ‘dashed’, ‘dotted’).

  • line_width (float or None, optional) – The width of the lines in the plot.

  • min_border (int or None, optional) – The minimum border size around the plot.

  • show_plot (bool or None, optional) – Whether to display the plot immediately after creation.

  • legend (LegendConfig or dict or None, optional) – Configuration for the plot legend.

  • feature_config (FeatureConfig or dict or None, optional) – Configuration for additional plot features.

  • backend (str, default None) – Backend to use instead of the backend specified in the option plotting.backend. For pyopenms_viz, options are one of (‘ms_matplotlib’, ‘ms_bokeh’, ‘ms_plotly’) Alternatively, to specify the plotting.backend for the whole session, set pd.options.plotting.backend.

  • **kwargs – Additional keyword arguments to be passed to the plotting function.

Return type:

None

Examples

>>> import pandas as pd
>>>
>>> data = pd.DataFrame(dict'x': [1, 2, 3], 'y': [4, 5, 6]))
>>> data.plot(x='x', y='y', kind='spectrum', backend='pomsvim')