massdash.plotting.InteractivePlotter

class massdash.plotting.InteractivePlotter(config: PlotConfig, verbose: bool = False)

Bases: GenericPlotter

Class for generating interactive plots using Bokeh.

config

The configuration object for the plot.

Type:

PlotConfig

verbose

Enables verbose mode.

Type:

bool

plot(transitionGroup: TransitionGroup, features: List[TransitionGroupFeature] | None = None, plot_type: Literal['chromatogram', 'mobilogram', 'spectrum'] = 'chromatogram', feature_legend_labels: List[str] | None = []) figure

Plots the given transitionGroup using the specified plot type.

Parameters:
  • transitionGroup (TransitionGroup) – The transition group to plot.

  • features (Optional[List[TransitionGroupFeature]], optional) – A list of peak features to highlight on the plot. Defaults to None.

  • plot_type (Literal['chromatogram', 'mobilogram', 'spectrum'], optional) – The type of plot to generate. Defaults to ‘chromatogram’.

Returns:

The generated plot as a Bokeh figure object.

Return type:

figure

plot_chromatogram(transitionGroup: TransitionGroup, features: List[TransitionGroupFeature] | None = [], feature_legend_labels: List[str] | None = []) figure

Plots a chromatogram for a given TransitionGroup.

Parameters:

transitionGroup (TransitionGroup) – The TransitionGroup to plot.

Returns:

A Bokeh figure object representing the chromatogram plot.

plot_mobilogram(transitionGroup: TransitionGroup) figure

Plots the mobilogram for a given TransitionGroup.

Parameters:

transitionGroup (TransitionGroup) – The TransitionGroup to plot the mobilogram for.

Returns:

The matplotlib figure object containing the mobilogram plot.

Return type:

figure

plot_spectra(transitionGroup: TransitionGroup) figure

Plots the spectra data for a given transition group.

Parameters:

transitionGroupTransitionGroup

The transition group for which to plot the spectra data.

Returns:

figurebokeh.plotting.figure

The Bokeh figure object containing the plotted spectra data.

process_chrom(p: figure, chrom: Chromatogram, label: str, color: str = 'black', line_type: str = 'dashed', is_precursor: bool = True, transitionGroup: TransitionGroup = None) Line

Process a chromatogram and add it to a Bokeh figure.

Parameters:
  • p (figure) – Bokeh figure to add the chromatogram to.

  • chrom (Chromatogram) – Chromatogram object to process.

  • label (str) – Label for the chromatogram.

  • color (str, optional) – Color for the chromatogram line. Defaults to ‘black’.

  • line_type (str, optional) – Line type for the chromatogram line. Defaults to “dashed”.

  • is_precursor (bool, optional) – Whether the chromatogram is for the precursor ion. Defaults to True.

  • transitionGroup (TransitionGroup, optional) – TransitionGroup object containing precursor and product ion information. Defaults to None.

Returns:

Bokeh line object representing the chromatogram.

Return type:

Line

process_mobilo(p: figure, mobilo: Mobilogram, label: str, color: str = 'black', line_type: str = 'dashed', is_precursor: bool = True, transitionGroup: TransitionGroup = None) Line

Process a mobilogram and add it to a Bokeh figure.

Parameters:
  • p (figure) – Bokeh figure to add the mobilogram to.

  • mobilo (Mobilogram) – Mobilogram object to process.

  • label (str) – Label for the mobilogram.

  • color (str, optional) – Color for the mobilogram line. Defaults to ‘black’.

  • line_type (str, optional) – Line type for the mobilogram line. Defaults to “dashed”.

  • is_precursor (bool, optional) – Whether the mobilogram is for the precursor ion. Defaults to True.

  • transitionGroup (TransitionGroup, optional) – TransitionGroup object containing precursor and product ion information. Defaults to None.

Returns:

Bokeh line object representing the mobilogram.

Return type:

Line

process_spectra(p: figure, spectra: Spectrum, label: str, color: str = 'black', line_type: str = 'dashed', is_precursor: bool = True, transitionGroup: TransitionGroup = None) Line

Process a spectrum and add it to a Bokeh figure.

Parameters:
  • p (figure) – Bokeh figure to add the spectrum to.

  • spectra (Spectrum) – Spectrum object to process.

  • label (str) – Label for the spectrum.

  • color (str, optional) – Color for the spectrum line. Defaults to ‘black’.

  • line_type (str, optional) – Line type for the spectrum line. Defaults to “dashed”.

  • is_precursor (bool, optional) – Whether the spectrum is for the precursor ion. Defaults to True.

  • transitionGroup (TransitionGroup, optional) – TransitionGroup object containing precursor and product ion information. Defaults to None.

Returns:

Bokeh line object representing the spectrum.

Return type:

Line

show()

Show the plot.