raster_plot

Contents

raster_plot#

class braintools.visualize.raster_plot(ts, sp_matrix, ax=None, marker='.', markersize=2, color='k', xlabel='Time (ms)', ylabel='Neuron index', xlim=None, ylim=None, title=None, show=False, alpha=1.0, **kwargs)#

Show the raster plot of the spikes.

Parameters:
  • ts (np.ndarray) – The run times.

  • sp_matrix (np.ndarray) – The spike matrix which records the spike information. It can be easily accessed by specifying the monitors of NeuGroup by: neu = NeuGroup(..., monitors=['spike'])

  • ax (Axes, optional) – The figure axes. If None, uses plt.

  • marker (str) – The marker style.

  • markersize (int) – The size of the marker.

  • color (str) – The color of the marker.

  • xlim (list, tuple, optional) – The xlim.

  • ylim (list, tuple, optional) – The ylim.

  • xlabel (str) – The xlabel.

  • ylabel (str) – The ylabel.

  • title (str, optional) – The plot title.

  • show (bool) – Show the figure.

  • alpha (float) – Alpha transparency value.

  • **kwargs – Additional keyword arguments passed to scatter().

Returns:

ax – The axes object containing the plot.

Return type:

matplotlib.axes.Axes

Raises:

ValueError – If ts is None or sp_matrix is empty.