brian2tools.plotting.data module¶
Module to plot simulation data (raster plots, etc.)
- brian2tools.plotting.data.plot_raster(spike_indices, spike_times, time_unit=<Mock name='mock.ms' id='130266780174144'>, axes=None, **kwds)[source]¶
Plot a “raster plot”, a plot of neuron indices over spike times. The default marker used for plotting is
'.', it can be overriden with themarkerkeyword argument.- Parameters:
spike_indices (
ndarray) – The indices of spiking neurons, corresponding to the times given inspike_times.spike_times (
Quantity) – A sequence of spike times.time_unit (
Unit, optional) – The unit to use for the time axis. Defaults toms, but longer simulations could usesecond, for example.axes (
Axes, optional) – TheAxesinstance used for plotting. Defaults toNonewhich means that a newAxeswill be created for the plot.kwds (dict, optional) – Any additional keywords command will be handed over to matplotlib’s
plotcommand. This can be used to set plot properties such as thecolor.
- Returns:
axes – The
Axesinstance that was used for plotting. This object allows to modify the plot further, e.g. by setting the plotted range, the axis labels, the plot title, etc.- Return type:
- brian2tools.plotting.data.plot_rate(times, rate, time_unit=<Mock name='mock.ms' id='130266780174144'>, rate_unit=<Mock name='mock.Hz' id='130266780174336'>, axes=None, **kwds)[source]¶
- Parameters:
times (
Quantity) – The time points at which therateis measured.rate (
Quantity) – The population rate for each time point intimestime_unit (
Unit, optional) – The unit to use for the time axis. Defaults toms, but longer simulations could usesecond, for example.time_unit – The unit to use for the rate axis. Defaults to
Hz.axes (
Axes, optional) – TheAxesinstance used for plotting. Defaults toNonewhich means that a newAxeswill be created for the plot.kwds (dict, optional) – Any additional keywords command will be handed over to matplotlib’s
plotcommand. This can be used to set plot properties such as thecolor.
- Returns:
axes – The
Axesinstance that was used for plotting. This object allows to modify the plot further, e.g. by setting the plotted range, the axis labels, the plot title, etc.- Return type:
- brian2tools.plotting.data.plot_state(times, values, time_unit=<Mock name='mock.ms' id='130266780174144'>, var_unit=None, var_name=None, axes=None, **kwds)[source]¶
- Parameters:
times (
Quantity) – The array of times for the data points given invalues.values (
Quantity,ndarray) – The values to plot, either a 1D array with the same length astimes, or a 2D array withlen(times)rows.time_unit (
Unit, optional) – The unit to use for the time axis. Defaults toms, but longer simulations could usesecond, for example.var_unit (
Unit, optional) – The unit to use to plot thevalues(e.g.mVfor a membrane potential). If none is given (the default), an attempt is made to find a good scale automatically based on thevalues.var_name (str, optional) – The name of the variable that is plotted. Used for the axis label.
axes (
Axes, optional) – TheAxesinstance used for plotting. Defaults toNonewhich means that a newAxeswill be created for the plot.kwds (dict, optional) – Any additional keywords command will be handed over to matplotlib’s
plotcommand. This can be used to set plot properties such as thecolor.
- Returns:
axes – The
Axesinstance that was used for plotting. This object allows to modify the plot further, e.g. by setting the plotted range, the axis labels, the plot title, etc.- Return type: