epyr.plot module

The epyr.plot module provides specialized plotting functions for EPR spectroscopy data visualization.

Overview

This module offers publication-quality plotting tools specifically designed for EPR data:

  • 2D spectral maps: Field vs. angle/frequency/time plots

  • Waterfall plots: Stacked 1D spectra

  • EPR-specific styling: Appropriate axis labels, colormaps, and formatting

  • Interactive plotting: Integration with matplotlib for customization

Main Classes and Functions

Plot Configuration

Simple plotting module for EPR data from eprload.

This module provides simple plotting functions for data obtained with eprload(): - plot_1d: Plot 1D EPR spectra - plot_2d_map: Plot 2D data as color map - plot_2d_waterfall: Plot 2D data as waterfall plot

Based on the _plot_data function from eprload.py

epyr.plot.plot_1d(x, y, params=None, title=None, ax=None)[source]

Plot 1D EPR data.

Parameters:
  • x (np.ndarray, list, or None) – X-axis data from eprload. Falls back to point index if None or shape mismatch.

  • y (np.ndarray) – 1D EPR signal array.

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> from epyr import eprload, plot_1d
>>> x, y, params, _ = eprload("examples/data/130406SB_CaWO4_Er_CW_5K_20.DSC")
>>> fig, ax = plot_1d(x, y, params, title="CaWO4:Er, 5 K")

Reuse an existing axes (subplot composition):

>>> import matplotlib.pyplot as plt
>>> fig, axes = plt.subplots(1, 2)
>>> plot_1d(x, y, params, ax=axes[0])
epyr.plot.plot_2d_map(x, y, params=None, title=None, ax=None, cmap='magma', vmin=None, vmax=None)[source]

Plot 2D EPR data as a color map.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

  • cmap (str, optional) – Matplotlib colormap name (default: “magma”).

  • vmin (float, optional) – Lower bound of the color scale. Defaults to data minimum.

  • vmax (float, optional) – Upper bound of the color scale. Defaults to data maximum.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> fig, ax = plot_2d_map(x, y, params, vmin=-100, vmax=100)
>>> fig, ax = plot_2d_map(x, y, params, vmin=0)  # clip negatives
epyr.plot.plot_2d_waterfall(x, y, params=None, title=None, ax=None, offset_factor=0.5, max_traces=20, cmap='viridis', lw=0.75, clip_factor=None)[source]

Plot 2D EPR data as a waterfall plot.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

  • offset_factor (float, optional) – Vertical spacing between traces as a fraction of the total data range (default: 0.5).

  • max_traces (int, optional) – Maximum number of traces to display. If ny > max_traces, traces are subsampled uniformly (default: 20).

  • cmap (str, optional) – Matplotlib colormap used to color-code traces (default: “viridis”).

  • lw (float, optional) – Line width for each trace (default: 0.75).

  • clip_factor (float, optional) – Clip each trace at clip_factor * max(|trace|) before adding the vertical offset. None disables clipping (default). A value of 0.5 clips at 50% of the trace maximum.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> from epyr import eprload, plot_2d_waterfall
>>> x, y, params, _ = eprload("examples/data/Rabi2D_GdCaWO4_13dB_3057G.DSC")
>>> fig, ax = plot_2d_waterfall(x, y, params, max_traces=10)

Tighter spacing with strong clipping (useful for noisy backgrounds):

>>> fig, ax = plot_2d_waterfall(x, y, params, offset_factor=0.2, clip_factor=0.3)
epyr.plot.plot_2d_slicer(x, y, params=None, title=None, slice_direction='horizontal', cmap='magma')[source]

Interactive 2D EPR data slicer with a slider control.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title shown above the active slice panel.

  • slice_direction ({'horizontal', 'vertical'}, optional) – Axis along which to slice (default: ‘horizontal’).

  • cmap (str, optional) – Matplotlib colormap name for the overview panel (default: “magma”).

Returns:

Keys: ‘figure’, ‘ax_main’, ‘ax_overview’, ‘slider’, ‘line’, ‘slice_line’.

Return type:

dict

Notes

Requires an interactive matplotlib backend. In Jupyter, activate with %matplotlib widget or %matplotlib notebook before calling.

Examples

>>> from epyr import eprload, plot_2d_slicer
>>> x, y, params, _ = eprload("examples/data/Rabi2D_GdCaWO4_13dB_3057G.DSC")
>>> handles = plot_2d_slicer(x, y, params, slice_direction="vertical")
>>> handles["slider"].set_val(50)  # programmatic slider control

2D Plotting Functions

Simple plotting module for EPR data from eprload.

This module provides simple plotting functions for data obtained with eprload(): - plot_1d: Plot 1D EPR spectra - plot_2d_map: Plot 2D data as color map - plot_2d_waterfall: Plot 2D data as waterfall plot

Based on the _plot_data function from eprload.py

epyr.plot.plot_1d(x, y, params=None, title=None, ax=None)[source]

Plot 1D EPR data.

Parameters:
  • x (np.ndarray, list, or None) – X-axis data from eprload. Falls back to point index if None or shape mismatch.

  • y (np.ndarray) – 1D EPR signal array.

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> from epyr import eprload, plot_1d
>>> x, y, params, _ = eprload("examples/data/130406SB_CaWO4_Er_CW_5K_20.DSC")
>>> fig, ax = plot_1d(x, y, params, title="CaWO4:Er, 5 K")

Reuse an existing axes (subplot composition):

>>> import matplotlib.pyplot as plt
>>> fig, axes = plt.subplots(1, 2)
>>> plot_1d(x, y, params, ax=axes[0])
epyr.plot.plot_2d_map(x, y, params=None, title=None, ax=None, cmap='magma', vmin=None, vmax=None)[source]

Plot 2D EPR data as a color map.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

  • cmap (str, optional) – Matplotlib colormap name (default: “magma”).

  • vmin (float, optional) – Lower bound of the color scale. Defaults to data minimum.

  • vmax (float, optional) – Upper bound of the color scale. Defaults to data maximum.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> fig, ax = plot_2d_map(x, y, params, vmin=-100, vmax=100)
>>> fig, ax = plot_2d_map(x, y, params, vmin=0)  # clip negatives
epyr.plot.plot_2d_waterfall(x, y, params=None, title=None, ax=None, offset_factor=0.5, max_traces=20, cmap='viridis', lw=0.75, clip_factor=None)[source]

Plot 2D EPR data as a waterfall plot.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

  • offset_factor (float, optional) – Vertical spacing between traces as a fraction of the total data range (default: 0.5).

  • max_traces (int, optional) – Maximum number of traces to display. If ny > max_traces, traces are subsampled uniformly (default: 20).

  • cmap (str, optional) – Matplotlib colormap used to color-code traces (default: “viridis”).

  • lw (float, optional) – Line width for each trace (default: 0.75).

  • clip_factor (float, optional) – Clip each trace at clip_factor * max(|trace|) before adding the vertical offset. None disables clipping (default). A value of 0.5 clips at 50% of the trace maximum.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> from epyr import eprload, plot_2d_waterfall
>>> x, y, params, _ = eprload("examples/data/Rabi2D_GdCaWO4_13dB_3057G.DSC")
>>> fig, ax = plot_2d_waterfall(x, y, params, max_traces=10)

Tighter spacing with strong clipping (useful for noisy backgrounds):

>>> fig, ax = plot_2d_waterfall(x, y, params, offset_factor=0.2, clip_factor=0.3)
epyr.plot.plot_2d_slicer(x, y, params=None, title=None, slice_direction='horizontal', cmap='magma')[source]

Interactive 2D EPR data slicer with a slider control.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title shown above the active slice panel.

  • slice_direction ({'horizontal', 'vertical'}, optional) – Axis along which to slice (default: ‘horizontal’).

  • cmap (str, optional) – Matplotlib colormap name for the overview panel (default: “magma”).

Returns:

Keys: ‘figure’, ‘ax_main’, ‘ax_overview’, ‘slider’, ‘line’, ‘slice_line’.

Return type:

dict

Notes

Requires an interactive matplotlib backend. In Jupyter, activate with %matplotlib widget or %matplotlib notebook before calling.

Examples

>>> from epyr import eprload, plot_2d_slicer
>>> x, y, params, _ = eprload("examples/data/Rabi2D_GdCaWO4_13dB_3057G.DSC")
>>> handles = plot_2d_slicer(x, y, params, slice_direction="vertical")
>>> handles["slider"].set_val(50)  # programmatic slider control

Usage Examples

2D Spectral Mapping

from epyr.plot import plot_2d_spectral_map
import numpy as np
import matplotlib.pyplot as plt

# Create 2D EPR data (e.g., field vs. angle)
field_axis = np.linspace(3200, 3400, 200)  # Gauss
angle_axis = np.linspace(0, 180, 37)       # Degrees

# Your 2D EPR data array (shape: angle x field)
epr_2d_data = load_your_2d_data()  # Shape: (37, 200)

# Create 2D plot
fig, ax = plot_2d_spectral_map(
    field_axis, angle_axis, epr_2d_data,
    x_unit='G', y_unit='°',
    title='EPR Angular Dependence'
)

plt.show()

Custom Styling

from epyr.plot import EPRPlotConfig

# Configure EPR-specific plot settings
config = EPRPlotConfig()

# Use configuration for consistent styling
fig, ax = plot_2d_spectral_map(
    x_axis, y_axis, data_2d,
    figsize=config.DEFAULT_FIGSIZE_2D,
    cmap=config.DEFAULT_CMAP
)

Advanced Plotting Options

# Customize colormap and ranges
fig, ax = plot_2d_spectral_map(
    field_axis, angle_axis, epr_2d_data,
    x_unit='mT', y_unit='°',
    title='Single Crystal EPR',
    cmap='RdBu_r',  # Red-blue colormap
    vmin=-1000, vmax=1000,  # Set intensity range
    interpolation='bilinear'
)

# Add custom colorbar label
cbar = ax.collections[0].colorbar
cbar.set_label('EPR Signal (a.u.)', rotation=270, labelpad=20)

# Save high-resolution figure
fig.savefig('epr_2d.png', dpi=300, bbox_inches='tight')

Plot Types

2D Spectral Maps

For visualizing 2D EPR datasets:

  • Field vs. Angle: Single crystal EPR measurements

  • Field vs. Time: Time-resolved EPR studies

  • Field vs. Temperature: Variable temperature EPR

  • Field vs. Frequency: Multi-frequency EPR

Waterfall Plots

For displaying series of 1D spectra:

  • Angular series: Multiple orientations

  • Temperature series: Variable temperature studies

  • Time series: Kinetic measurements

  • Power series: Saturation studies

Styling Options

Colormaps

EPR-appropriate colormaps:

  • viridis: Default, perceptually uniform

  • plasma: High contrast for weak signals

  • RdBu_r: Red-blue for absorption/emission

  • seismic: Blue-white-red for derivatives

Axis Labels

Automatic unit formatting:

  • Magnetic field: G, mT, T

  • Frequency: Hz, MHz, GHz

  • Angle: degrees, radians

  • Temperature: K, °C

  • Time: s, ms, μs

Plot Configuration

Simple plotting module for EPR data from eprload.

This module provides simple plotting functions for data obtained with eprload(): - plot_1d: Plot 1D EPR spectra - plot_2d_map: Plot 2D data as color map - plot_2d_waterfall: Plot 2D data as waterfall plot

Based on the _plot_data function from eprload.py

epyr.plot.plot_1d(x, y, params=None, title=None, ax=None)[source]

Plot 1D EPR data.

Parameters:
  • x (np.ndarray, list, or None) – X-axis data from eprload. Falls back to point index if None or shape mismatch.

  • y (np.ndarray) – 1D EPR signal array.

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> from epyr import eprload, plot_1d
>>> x, y, params, _ = eprload("examples/data/130406SB_CaWO4_Er_CW_5K_20.DSC")
>>> fig, ax = plot_1d(x, y, params, title="CaWO4:Er, 5 K")

Reuse an existing axes (subplot composition):

>>> import matplotlib.pyplot as plt
>>> fig, axes = plt.subplots(1, 2)
>>> plot_1d(x, y, params, ax=axes[0])
epyr.plot.plot_2d_map(x, y, params=None, title=None, ax=None, cmap='magma', vmin=None, vmax=None)[source]

Plot 2D EPR data as a color map.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

  • cmap (str, optional) – Matplotlib colormap name (default: “magma”).

  • vmin (float, optional) – Lower bound of the color scale. Defaults to data minimum.

  • vmax (float, optional) – Upper bound of the color scale. Defaults to data maximum.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> fig, ax = plot_2d_map(x, y, params, vmin=-100, vmax=100)
>>> fig, ax = plot_2d_map(x, y, params, vmin=0)  # clip negatives
epyr.plot.plot_2d_waterfall(x, y, params=None, title=None, ax=None, offset_factor=0.5, max_traces=20, cmap='viridis', lw=0.75, clip_factor=None)[source]

Plot 2D EPR data as a waterfall plot.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

  • offset_factor (float, optional) – Vertical spacing between traces as a fraction of the total data range (default: 0.5).

  • max_traces (int, optional) – Maximum number of traces to display. If ny > max_traces, traces are subsampled uniformly (default: 20).

  • cmap (str, optional) – Matplotlib colormap used to color-code traces (default: “viridis”).

  • lw (float, optional) – Line width for each trace (default: 0.75).

  • clip_factor (float, optional) – Clip each trace at clip_factor * max(|trace|) before adding the vertical offset. None disables clipping (default). A value of 0.5 clips at 50% of the trace maximum.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> from epyr import eprload, plot_2d_waterfall
>>> x, y, params, _ = eprload("examples/data/Rabi2D_GdCaWO4_13dB_3057G.DSC")
>>> fig, ax = plot_2d_waterfall(x, y, params, max_traces=10)

Tighter spacing with strong clipping (useful for noisy backgrounds):

>>> fig, ax = plot_2d_waterfall(x, y, params, offset_factor=0.2, clip_factor=0.3)
epyr.plot.plot_2d_slicer(x, y, params=None, title=None, slice_direction='horizontal', cmap='magma')[source]

Interactive 2D EPR data slicer with a slider control.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title shown above the active slice panel.

  • slice_direction ({'horizontal', 'vertical'}, optional) – Axis along which to slice (default: ‘horizontal’).

  • cmap (str, optional) – Matplotlib colormap name for the overview panel (default: “magma”).

Returns:

Keys: ‘figure’, ‘ax_main’, ‘ax_overview’, ‘slider’, ‘line’, ‘slice_line’.

Return type:

dict

Notes

Requires an interactive matplotlib backend. In Jupyter, activate with %matplotlib widget or %matplotlib notebook before calling.

Examples

>>> from epyr import eprload, plot_2d_slicer
>>> x, y, params, _ = eprload("examples/data/Rabi2D_GdCaWO4_13dB_3057G.DSC")
>>> handles = plot_2d_slicer(x, y, params, slice_direction="vertical")
>>> handles["slider"].set_val(50)  # programmatic slider control

The EPRPlotConfig class provides default settings optimized for EPR data visualization.

Complete API

Simple plotting module for EPR data from eprload.

This module provides simple plotting functions for data obtained with eprload(): - plot_1d: Plot 1D EPR spectra - plot_2d_map: Plot 2D data as color map - plot_2d_waterfall: Plot 2D data as waterfall plot

Based on the _plot_data function from eprload.py

epyr.plot.plot_1d(x, y, params=None, title=None, ax=None)[source]

Plot 1D EPR data.

Parameters:
  • x (np.ndarray, list, or None) – X-axis data from eprload. Falls back to point index if None or shape mismatch.

  • y (np.ndarray) – 1D EPR signal array.

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> from epyr import eprload, plot_1d
>>> x, y, params, _ = eprload("examples/data/130406SB_CaWO4_Er_CW_5K_20.DSC")
>>> fig, ax = plot_1d(x, y, params, title="CaWO4:Er, 5 K")

Reuse an existing axes (subplot composition):

>>> import matplotlib.pyplot as plt
>>> fig, axes = plt.subplots(1, 2)
>>> plot_1d(x, y, params, ax=axes[0])
epyr.plot.plot_2d_map(x, y, params=None, title=None, ax=None, cmap='magma', vmin=None, vmax=None)[source]

Plot 2D EPR data as a color map.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

  • cmap (str, optional) – Matplotlib colormap name (default: “magma”).

  • vmin (float, optional) – Lower bound of the color scale. Defaults to data minimum.

  • vmax (float, optional) – Upper bound of the color scale. Defaults to data maximum.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> fig, ax = plot_2d_map(x, y, params, vmin=-100, vmax=100)
>>> fig, ax = plot_2d_map(x, y, params, vmin=0)  # clip negatives
epyr.plot.plot_2d_waterfall(x, y, params=None, title=None, ax=None, offset_factor=0.5, max_traces=20, cmap='viridis', lw=0.75, clip_factor=None)[source]

Plot 2D EPR data as a waterfall plot.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title.

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on. A new figure is created if not provided.

  • offset_factor (float, optional) – Vertical spacing between traces as a fraction of the total data range (default: 0.5).

  • max_traces (int, optional) – Maximum number of traces to display. If ny > max_traces, traces are subsampled uniformly (default: 20).

  • cmap (str, optional) – Matplotlib colormap used to color-code traces (default: “viridis”).

  • lw (float, optional) – Line width for each trace (default: 0.75).

  • clip_factor (float, optional) – Clip each trace at clip_factor * max(|trace|) before adding the vertical offset. None disables clipping (default). A value of 0.5 clips at 50% of the trace maximum.

Returns:

  • fig (matplotlib.figure.Figure)

  • ax (matplotlib.axes.Axes)

Return type:

Tuple[Figure, Axes]

Examples

>>> from epyr import eprload, plot_2d_waterfall
>>> x, y, params, _ = eprload("examples/data/Rabi2D_GdCaWO4_13dB_3057G.DSC")
>>> fig, ax = plot_2d_waterfall(x, y, params, max_traces=10)

Tighter spacing with strong clipping (useful for noisy backgrounds):

>>> fig, ax = plot_2d_waterfall(x, y, params, offset_factor=0.2, clip_factor=0.3)
epyr.plot.plot_2d_slicer(x, y, params=None, title=None, slice_direction='horizontal', cmap='magma')[source]

Interactive 2D EPR data slicer with a slider control.

Parameters:
  • x (np.ndarray, list, or None) – Axis data from eprload. A list of two arrays sets both x and y axes.

  • y (np.ndarray) – 2D EPR signal array, shape (ny, nx).

  • params (dict, optional) – Parameter dictionary from eprload, used to extract axis labels and units.

  • title (str, optional) – Plot title shown above the active slice panel.

  • slice_direction ({'horizontal', 'vertical'}, optional) – Axis along which to slice (default: ‘horizontal’).

  • cmap (str, optional) – Matplotlib colormap name for the overview panel (default: “magma”).

Returns:

Keys: ‘figure’, ‘ax_main’, ‘ax_overview’, ‘slider’, ‘line’, ‘slice_line’.

Return type:

dict

Notes

Requires an interactive matplotlib backend. In Jupyter, activate with %matplotlib widget or %matplotlib notebook before calling.

Examples

>>> from epyr import eprload, plot_2d_slicer
>>> x, y, params, _ = eprload("examples/data/Rabi2D_GdCaWO4_13dB_3057G.DSC")
>>> handles = plot_2d_slicer(x, y, params, slice_direction="vertical")
>>> handles["slider"].set_val(50)  # programmatic slider control