sdr.plot.raster(x: ArrayLike, length: int | None = None, stride: int | None = None, sample_rate: float | None = None, color: 'index' | str = 'index', persistence: bool = False, colorbar: bool = True, ax: Axes | None = None, **kwargs)

Plots a raster of the time-domain signal \(x[n]\).

Parameters:
x: ArrayLike

The real time-domain signal \(x[n]\). If x is 1D, the rastering is determined by length and stride. If x is 2D, the rows correspond to each raster.

length: int | None = None

The length of each raster in samples. This must be provided if x is 1D.

stride: int | None = None

The stride between each raster in samples. If None, the stride is set to length.

sample_rate: float | None = None

The sample rate \(f_s\) of the signal in samples/s. If None, the x-axis will be labeled as “Samples”.

color: 'index' | str = 'index'

Indicates how to color the rasters. If "index", the rasters are colored based on their index. If a valid Matplotlib color, the rasters are all colored with that color.

persistence: bool = False

Indicates whether to plot the raster as a persistence plot. A persistence plot is a 2D histogram of the rasters.

colorbar: bool = True

Indicates whether to add a colorbar to the plot. This is only added if color="index" or persistence=True.

ax: Axes | None = None

The axis to plot on. If None, the current axis is used.

**kwargs

Additional keyword arguments to pass to Matplotlib functions.

If persistence=False, the following keyword arguments are passed to matplotlib.collections.LineCollection. The defaults may be overwritten.

  • "linewidths": 1

  • "linestyles": "solid"

  • "cmap": "rainbow"

If persistence=True, the following keyword arguments are passed to matplotlib.pyplot.pcolormesh(). The defaults may be overwritten.

  • "bins": (800, 200) # Passed to np.histogram2d()

  • "cmap": "rainbow"

  • "norm": "log"

  • "rasterized": True

  • "show_zero": False