Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Carpet Plots

As a quantitative alternative to the 2D waterfall plot (see 2. Waterfall Plots), carpet plots provide a top-down, 2D image representation of stacked spectra . They are 2D rasterized visualizations of 1D time-series data, effectively “rolling out” the time-domain flat on the floor. This approach eliminates visual occlusion, allowing for direct observation of signal intensities and frequency shifts across the stacking dimension (e.g., time or repetitions).

In xmris, this visualization is built around the CarpetConfig object, which includes specialized logic for truncating colormaps so your data never gets lost in absolute white or absolute black on printed paper.

1. Data Requirements

Before plotting, your xarray.DataArray must meet the following criteria:

2. Generating Synthetic Data

To ensure a 1:1 comparison with the waterfall plot, we will generate the exact same synthetic kinetic time-course. We simulate a hyperpolarized 13C experiment where Pyruvate decays and Lactate grows over 60 seconds.

Time series data generation

We will use the xmris.fitting.simulation module:

3. Basic Usage

Because plot.carpet() shares the same intelligent dimension parser as plot.waterfall(), you can call it without any dimension arguments.

<Figure size 800x500 with 2 Axes>

4. Advanced Configuration

Instantiating the CarpetConfig reveals specialized controls for the 2D grid. Notice how the default setting (grid_on=True) utilizes a subtle overlaid grid and inward-facing ticks to make reading exact coordinates effortless.

Loading...

We can customize the labels and adjust the colormap boundaries to make the contrast pop.

<Figure size 800x500 with 2 Axes>

5. Subplot Integration

Because our plotting functions return standard matplotlib.Axes objects, we can easily build a comprehensive, multi-panel figure combining the qualitative intuition of the Waterfall Plot with the quantitative rigor of the Carpet Plot.

<Figure size 1200x500 with 2 Axes>