Skip to content

Commit

Permalink
added raster plot
Browse files Browse the repository at this point in the history
  • Loading branch information
miladh committed Nov 30, 2018
1 parent f1ed886 commit c35bbd8
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions pylgn/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,46 @@ def __call__(self, value, clip=None):
return np.ma.masked_array(np.interp(value, x, y))


def raster_plot(data, xlabel="Time", ylabel="Neuron",
orientation='horizontal', lineoffsets=1, linelengths=0.5,
linewidths=None, colors=None, linestyles="solid"):

"""
Raster plot
Parameters
----------
data : list or ndarray
list/array of spike trains for individual locations.
Each row corresponds to a location.
xlabel : str, optional
ylabel : str, optional
orientation : {'horizontal', 'vertical'}, optional
lineoffsets : scalar or sequence of scalars, optional
linelengths : scalar or sequence of scalars, optional
linewidths : scalar, scalar sequence or None, optional
colors : color, sequence of colors or None, optional
linestyles : str or tuple or a sequence of such values, optional
"""
fig, ax = plt.subplots()
ax.eventplot(np.array(data), colors=colors, lineoffsets=lineoffsets, linelengths=linelengths,
orientation=orientation, linewidths=linewidths, linestyles=linestyles)
ax.set_ylabel(ylabel)
ax.set_xlabel(xlabel)
plt.show()

return fig, ax


def animate_cube(cube, title=None, dt=None,
vmin=None, vmax=None, cmap="RdBu_r",
save_anim=False, filename="anim.mp4", writer="ffmpeg"):
Expand Down

0 comments on commit c35bbd8

Please sign in to comment.