Spectrum#

A spectrum can be plot using kind = “spectrum”. In this plot, mass-to-charge ratio is on the x-axis and intensity is on the y-axis.

Parameters#

Parameter

Type

Description

Default

x*

str

The column name for the X-axis data. Required.

y*

str

The column name for the Y-axis data. Required.

by*

str

The column name for the grouping variable.

canvas*

Any

Canvas for the plot. For Bokeh, this is a bokeh.plotting.Figure object. For Matplotlib, this is an Axes object, and for Plotly, this is a plotly.graph_objects.Figure object. If none, axis will be created Defaults to None.

show_plot

bool

Whether to display the plot. Defaults to True.

True

direction

Literal[“horizontal”, “vertical”]

Direction of the line. Defaults to “vertical”.

“vertical”

reference_spectrum

pd.DataFrame | None

Reference spectrum data. Defaults to None.

None

mirror_spectrum

bool

Whether to mirror the spectrum. Defaults to False.

False

peak_color

str | None

Color of the peaks. Defaults to None.

None

bin_peaks

Union[Literal[“auto”], bool]

Whether to bin peaks. Defaults to False.

False

bin_method

Literal[“none”, “sturges”, “freedman-diaconis”, “mz-tol-bin”]

Method for binning peaks. Defaults to “mz-tol-bin”.

“mz-tol-bin”

num_x_bins

int

Number of bins along the X-axis, ignored if bin_peaks is False or “auto”. Defaults to 50.

50

mz_tol

Union[float, Literal[“freedman-diaconis”, “1pct-diff”]]

Tolerance for m/z binning. Defaults to “1pct-diff”.

“1pct-diff”

annotate_top_n_peaks

int | None | Literal[“all”]

Number of top peaks to annotate. Defaults to 5.

5

annotate_mz

bool

Whether to annotate m/z values. Defaults to True.

True

ion_annotation

str | None

Column for ion annotations. Defaults to None.

None

sequence_annotation

str | None

Column for sequence annotations. Defaults to None.

None

custom_annotation

str | None

Column for custom annotations. Defaults to None.

None

annotation_color

str | None

Color for annotations. Defaults to None.

None

aggregation_method

Literal[“mean”, “sum”, “max”]

Method for aggregating data. Defaults to “max”.

“max”

xlabel

str

Label for the X-axis. Defaults to “mass-to-charge”.

“mass-to-charge”

ylabel

str

Label for the Y-axis. Defaults to “Intensity”.

“Intensity”

title

str

Title of the plot. Defaults to “Mass Spectrum”.

“Mass Spectrum”

Example Usage#

Spectrum of Extracted DIA Data ms_bokeh

Spectrum of Extracted DIA Data ms_bokeh

Spectrum ms_bokeh

Spectrum ms_bokeh

Investigate Spctrum Binning ms_matplotlib

Investigate Spctrum Binning ms_matplotlib

Manuscript d Fructose Example ms_matplotlib

Manuscript d Fructose Example ms_matplotlib

Spectrum of Extracted DIA Data ms_matplotlib

Spectrum of Extracted DIA Data ms_matplotlib

Spectrum ms_matplotlib

Spectrum ms_matplotlib

Spectrum of Extracted DIA Data ms_plotly

Spectrum of Extracted DIA Data ms_plotly

Spectrum ms_plotly

Spectrum ms_plotly