alphatims.plotting¶
This module provides basic LC-TIMS-Q-TOF plots.
Functions:
|
Create a scatterplot / heatmap for a dataframe. |
|
Plot an XIC, mobilogram or spectrum as a lineplot. |
|
Create a total ion chromatogram (TIC) for the data. |
- alphatims.plotting.heatmap(df, x_axis_label: str, y_axis_label: str, title: str = '', z_axis_label: str = 'intensity', width: int = 1000, height: int = 320, rescale_to_minutes: bool = True, **kwargs)[source]¶
Create a scatterplot / heatmap for a dataframe.
The coordinates of the dataframe are projected (i.e. their intensities are summed) on the requested axes.
- Parameters
df (pd.DataFrame) – A dataframe with coordinates. This should be obtained by slicing an alphatims.bruker.TimsTOF object.
x_axis_label (str) –
A label that is used for projection (i.e. intensities are summed) on the x-axis. Options are:
mz
rt
mobility
y_axis_label (str) –
A label that is used for projection (i.e. intensities are summed) on the y-axis. Options are:
mz
rt
mobility
title (str) – The title of this plot. Will be prepended with “Heatmap”. Default is “”.
z_axis_label (str) – Should not be set for a 2D scatterplot / heatmap. Default is “intensity”.
width (int) – The width of this plot. Default is 1000.
height (int) – The height of this plot. Default is 320.
rescale_to_minutes (bool) – If True, the rt_values of the dataframe will be divided by 60. WARNING: this updates the dataframe directly and is persistent! Default is True.
**kwargs – Additional keyword arguments that will be passed to hv.Scatter.
- Returns
A scatter plot projected on the 2 dimensions.
- Return type
hv.Scatter
- alphatims.plotting.line_plot(timstof_data, selected_indices, x_axis_label: str, title: str = '', y_axis_label: str = 'intensity', remove_zeros: bool = False, trim: bool = True, width: int = 1000, height: int = 320, **kwargs)[source]¶
Plot an XIC, mobilogram or spectrum as a lineplot.
- Parameters
timstof_data (alphatims.bruker.TimsTOF) – An alphatims.bruker.TimsTOF data object.
selected_indices (np.int64[:]) – The raw indices that are selected for this plot. These are typically obtained by slicing the TimsTOF data object with e.g. data[…, “raw”].
x_axis_label (str) –
A label that is used for projection (i.e. intensities are summed) on the x-axis. Options are:
rt
mobility
mz
title (str) – The title of this plot. Will be prepended with “Spectrum”, “Mobilogram” or “XIC”. Default is “”.
y_axis_label (str) – Should not be set for a 1D line plot. Default is “intensity”.
remove_zeros (bool) – If True, zeros are removed. Note that a line plot connects consecutive points, which can lead to misleading plots if non-zeros are removed. If False, use the full range of the appropriate dimension of the timstof_data. Default is False.
trim (bool) – If True, zeros on the left and right are trimmed. Default is True.
width (int) – The width of this plot. Default is 1000.
height (int) – The height of this plot. Default is 320.
**kwargs – Additional keyword arguments that will be passed to hv.Curve.
- Returns
A curve plot that represents an XIC, mobilogram or spectrum.
- Return type
hv.Curve
- alphatims.plotting.tic_plot(timstof_data, title: str = '', width: int = 1000, height: int = 320, **kwargs)[source]¶
Create a total ion chromatogram (TIC) for the data.
- Parameters
timstof_data (alphatims.bruker.TimsTOF) – An alphatims.bruker.TimsTOF data object.
title (str) – The title of this plot. Will be prepended with “TIC”. Default is False
width (int) – The width of this plot. Default is 1000.
height (int) – The height of this plot. Default is 320.
**kwargs – Additional keyword arguments that will be passed to hv.Curve.
- Returns
The TIC of the provided dataset.
- Return type
hv.Curve