spiketools.plts.trials.plot_rate_by_time

spiketools.plts.trials.plot_rate_by_time(bin_times, trial_cfrs, average=None, shade=None, vline=None, colors=None, labels=None, stats=None, sig_level=0.05, ax=None, **plt_kwargs)[source]

Plot continuous firing rates across time.

Parameters:
bin_times1d array

Values of the time bins, to be plotted on the x-axis.

trial_cfrslist of array or dict

Continuous firing rate values, to be plotted on the y-axis. If each array is 1d values are plotted directly. If 2d, is to be averaged before plotting. If dict, each key is a condition label and each value the array of firing rates.

average{‘mean’, ‘median’}, optional

Averaging to apply to firing rate activity before plotting.

shade{‘sem’, ‘std’} or list of array, optional

Measure of variance to compute and/or plot as shading.

vlinefloat or list of float, optional

Location(s) to draw a vertical line. If None, no line is drawn.

colorsstr or list of str or dict, optional

Color(s) to plot the firing rates. If more than one, should match the number of conditions. If a dictionary, the labels should match the spike condition labels.

labelslist of str, optional

Labels for each set of y-values. If provided, a legend is added to the plot.

statslist, optional

Statistical results, including p-values, to use to annotate the plot.

sig_levelfloat, optional, default: 0.05

Threshold level to consider a result significant.

axAxes, optional

Axis object upon which to plot.

plt_kwargs

Additional arguments to pass into the plot function. Custom kwargs: ‘shade_alpha’, ‘legend_loc’.