intan.plotting package¶
All visualization utilities for EMG and Intan data, including waterfall, single-channel, and real-time plotting.
- waterfall(ax=None, data=None, channel_indices=None, time_vector=None, offset_increment=200, edges=[], plot_title='', line_width=0.2, colormap='rainbow', downsampling_factor=1, verbose=False)[source]¶
Creates a waterfall plot for the specified channels with a user-defined title, custom color styling, and scale bars for time and voltage.
- Parameters:
ax (matplotlib.axes.Axes) – The axes to plot on. If None, a new figure and axes are created.
data (numpy.ndarray) – 2D array of shape (num_channels, num_samples).
channel_indices (list) – List of channel indices to plot.
time_vector (numpy.ndarray) – 1D array of time values corresponding to the samples.
offset_increment (float) – Increment for offsetting each channel’s plot vertically.
edges (list) – List of edges to plot as vertical lines.
plot_title (str) – Title for the plot.
line_width (float) – Width of the lines in the plot.
colormap (str) – Colormap for the plot.
downsampling_factor (int) – Factor by which to downsample the data for plotting.
verbose (bool) – If True, prints additional information.
- add_scalebars(ax, scale_time=5, scale_voltage=10)[source]¶
Adds time and voltage scale bars to the plot in the lower left corner.
- Parameters:
ax (matplotlib.axes.Axes) – The axes to add the scale bars to.
scale_time (float) – Length of the timescale bar in seconds.
scale_voltage (float) – Length of the voltage scale bar in mV.
- insert_channel_labels(ax, time_vector, num_channels, num_labels=2, label_color='black', font_size=8)[source]¶
Inserts evenly spaced text labels on a multichannel plot to indicate selected channels.
- Parameters:
ax – Matplotlib Axes object.
time_vector – Time vector (used for x position of labels).
num_channels – Total number of channels plotted vertically.
num_labels – Number of labels to insert (default is 2).
label_color – Text color.
font_size – Size of the text.
- insert_vertical_labels(ax)[source]¶
Inserts vertical labels “Extensor” and “Flexor” for the two groups of channels.
- Parameters:
ax (matplotlib.axes.Axes) – The axes to plot on. If None, a new figure and axes are created.
- class RealtimePlotter(client, sampling_rate=2000.0, plotting_interval=1.0, samples_per_fetch=50, channels_to_plot=None)[source]¶
Bases:
object
Submodules¶
A realtime plotter for visualizing EMG data from a client.
- class RealtimePlotter(client, sampling_rate=2000.0, plotting_interval=1.0, samples_per_fetch=50, channels_to_plot=None)[source]¶
Bases:
object
Waterfall Plotting Module
- waterfall(ax=None, data=None, channel_indices=None, time_vector=None, offset_increment=200, edges=[], plot_title='', line_width=0.2, colormap='rainbow', downsampling_factor=1, verbose=False)[source]¶
Creates a waterfall plot for the specified channels with a user-defined title, custom color styling, and scale bars for time and voltage.
- Parameters:
ax (matplotlib.axes.Axes) – The axes to plot on. If None, a new figure and axes are created.
data (numpy.ndarray) – 2D array of shape (num_channels, num_samples).
channel_indices (list) – List of channel indices to plot.
time_vector (numpy.ndarray) – 1D array of time values corresponding to the samples.
offset_increment (float) – Increment for offsetting each channel’s plot vertically.
edges (list) – List of edges to plot as vertical lines.
plot_title (str) – Title for the plot.
line_width (float) – Width of the lines in the plot.
colormap (str) – Colormap for the plot.
downsampling_factor (int) – Factor by which to downsample the data for plotting.
verbose (bool) – If True, prints additional information.
- add_scalebars(ax, scale_time=5, scale_voltage=10)[source]¶
Adds time and voltage scale bars to the plot in the lower left corner.
- Parameters:
ax (matplotlib.axes.Axes) – The axes to add the scale bars to.
scale_time (float) – Length of the timescale bar in seconds.
scale_voltage (float) – Length of the voltage scale bar in mV.
- insert_channel_labels(ax, time_vector, num_channels, num_labels=2, label_color='black', font_size=8)[source]¶
Inserts evenly spaced text labels on a multichannel plot to indicate selected channels.
- Parameters:
ax – Matplotlib Axes object.
time_vector – Time vector (used for x position of labels).
num_channels – Total number of channels plotted vertically.
num_labels – Number of labels to insert (default is 2).
label_color – Text color.
font_size – Size of the text.