visualizerasterplotrasterplot

rasterplot

visualize.rasterplot.rasterplot(df, colormap=None, ax=None, label=None, groupby_attribute=None, tlim=None, reset_index=True)

Creates a rasterplot from spike times dataframe.

If df is a dask.DataFrame: parallel plotting is used (not recommended, causes bad quality) If df is a pandas.DataFrame, serial plotting is used

Parameters:
  • df (pandas.DataFrame) – A DataFrame containing the spike times.

  • colormap (dict, optional) – A colormap to use for the plot. Must map a label from groupby_attribute to a color.

  • ax (matplotlib.axes.Axes, optional) – An optional Matplotlib Axes object to plot on. If not provided, a new figure and axes are created.

  • label (str, optional) – The label for the plot. Default is None.

  • groupby_attribute (str, optional) – The column name in the DataFrame to group by. Default is None.

  • tlim (tuple, optional) – The x-axis limits for the plot. Default is None.

  • reset_index (bool, optional) – If True, reset the index of the DataFrame. Default is True.

Returns:

Figure object containing the rasterplot.

Return type:

matplotlib.pyplot.Figure