plotting.spectra
plotting.spectra
Functions¶
| Name | Description |
|---|---|
| annotate_metabolites | Annotate metabolite labels on a plot at specific ppm positions. |
| plot_fid | Plot one or more FIDs against a time axis. |
| plot_spectra | Plot one or more spectra against a chemical-shift (ppm) axis. |
| plot_spectra_over_time | Plot MRS unlocalized spectra over time using a FacetGrid. |
| set_default_spectra_ax_params | Set default spectra axis parameters for a given Axes object. |
| set_default_ticks | Set default tick parameters for a given Axes object. |
annotate_metabolites¶
plotting.spectra.annotate_metabolites(ax=None, freqs=None)Annotate metabolite labels on a plot at specific ppm positions.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| ax | matplotlib.axes.Axes | The axes to annotate. Defaults to the current axes. | None |
| freqs | dict | Mapping of metabolite name to ppm position. Defaults to a predefined set of common metabolites (DHO, Glu, Glx, Lac). | None |
Returns¶
| Name | Type | Description |
|---|---|---|
| matplotlib.axes.Axes | The annotated axes. |
plot_fid¶
plotting.spectra.plot_fid(
data=None,
time=None,
fids=None,
ax=None,
labels=None,
show_real=True,
show_imag=True,
**kwargs,
)Plot one or more FIDs against a time axis.
Pass either data (an xr.DataArray with a time dim/coord, e.g.
RawMRISeries.fids) or, as a manual fallback, both time (in ms) and
fids as plain arrays. This function does no processing itself — build
the time axis you want to see on the DataArray/array before calling.
plot_spectra¶
plotting.spectra.plot_spectra(
data=None,
ppm=None,
spectra=None,
ax=None,
labels=None,
line_kwargs=None,
**kwargs,
)Plot one or more spectra against a chemical-shift (ppm) axis.
Pass already-phased data — either data (an xr.DataArray with a
chemical_shift dim/coord, e.g. from MRSSeries.phase_avg_spec or
.xmr.phase()/.xmr.autophase()) or, as a manual fallback, both ppm
and spectra as plain arrays. This function does no phasing itself.
plot_spectra_over_time¶
plotting.spectra.plot_spectra_over_time(
df,
labels=None,
title='MRS Unlocalized Spectra Over Time',
**kwargs,
)Plot MRS unlocalized spectra over time using a FacetGrid.
Parameters¶
| Name | Type | Description | Default |
|---|---|---|---|
| df | pandas.DataFrame | DataFrame containing the spectra data with columns ["ppm", "Spectra_ID", "Intensity"]. | required |
| labels | list of str | Labels for the spectra. Defaults to an empty list. | None |
| title | str | Figure title. Defaults to “MRS Unlocalized Spectra Over Time”. | 'MRS Unlocalized Spectra Over Time' |
Returns¶
| Name | Type | Description |
|---|---|---|
| seaborn.FacetGrid | The resulting FacetGrid. |
set_default_spectra_ax_params¶
plotting.spectra.set_default_spectra_ax_params(ax, **kwargs)Set default spectra axis parameters for a given Axes object.
set_default_ticks¶
plotting.spectra.set_default_ticks(ax)Set default tick parameters for a given Axes object.