neuroprob/utils/plot.py
def raster_plot(figax, spikes, time_bins, bin_time_ms, units, colors=None, marker='|', markersize=2):
    """
    Visualize a 2D array representing point events, spikes has shape (timstep, units).
    
    :param list colors: colors to be included in the colormap
    :param string name: name the colormap
    :returns: figure and axis
    :rtype: tuple
    """
    fig, ax = figax
    if colors is None:
        col = ['k']*units
    else:
        col = colors
    for i in range(units):
        t = np.nonzero(spikes[i, :])[0]*bin_time_ms
        ax.scatter(t, (i+1) * np.ones_like(t), c=col[i], s=markersize, marker=marker)
    
    ax.set_xlim(0, time_bins * bin_time_ms)
    ax.set_ylim(0.1, units+0.9)
    ax.set_yticks(np.arange(1, units+1))

    return fig, ax

    Visualize a 2D array representing point events, spikes has shape (timstep, units).
    
    :param list colors: colors to be included in the colormap
    :param string name: name the colormap
    :returns: figure and axis
    :rtype: tuple
    
Visualize a 2D array representing point events, spikes has shape (timstep, units).
Visualize a 2D array representing point events spikes has shape ( timstep units ) .
def raster_plot(figax, spikes, time_bins, bin_time_ms, units, colors=None, marker='|', markersize=2):
    fig, ax = figax
    if colors is None:
        col = ['k']*units
    else:
        col = colors
    for i in range(units):
        t = np.nonzero(spikes[i, :])[0]*bin_time_ms
        ax.scatter(t, (i+1) * np.ones_like(t), c=col[i], s=markersize, marker=marker)
    ax.set_xlim(0, time_bins * bin_time_ms)
    ax.set_ylim(0.1, units+0.9)
    ax.set_yticks(np.arange(1, units+1))
    return fig, ax
def raster_plot ( figax , spikes , time_bins , bin_time_ms , units , colors = None , marker = '|' , markersize = 2 ) : fig , ax = figax if colors is None : col = [ 'k' ] * units else : col = colors for i in range ( units ) : t = np . nonzero ( spikes [ i , : ] ) [ 0 ] * bin_time_ms ax . scatter ( t , ( i + 1 ) * np . ones_like ( t ) , c = col [ i ] , s = markersize , marker = marker ) ax . set_xlim ( 0 , time_bins * bin_time_ms ) ax . set_ylim ( 0.1 , units + 0.9 ) ax . set_yticks ( np . arange ( 1 , units + 1 ) ) return fig , ax
Visualize a 2D array representing point events, spikes has shape (timstep, units).
Visualize a 2D array representing point events spikes has shape ( timstep units ) .
"""
    Visualize a 2D array representing point events, spikes has shape (timstep, units).
    
    :param list colors: colors to be included in the colormap
    :param string name: name the colormap
    :returns: figure and axis
    :rtype: tuple
    """
figure and axis
figure and axis
tuple
figax
spikes
time_bins
bin_time_ms
units
colors
colors to be included in the colormap
colors to be included in the colormap
marker
markersize
name
name the colormap
name the colormap