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='140273157208272'>, 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 themarker
keyword 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) – TheAxes
instance used for plotting. Defaults toNone
which means that a newAxes
will be created for the plot. - kwds (dict, optional) – Any additional keywords command will be handed over to matplotlib’s
plot
command. This can be used to set plot properties such as thecolor
.
Returns: axes – The
Axes
instance 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: - spike_indices (
-
brian2tools.plotting.data.
plot_state
(times, values, time_unit=<Mock name='mock.ms' id='140273157208272'>, 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.mV
for 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) – TheAxes
instance used for plotting. Defaults toNone
which means that a newAxes
will be created for the plot. - kwds (dict, optional) – Any additional keywords command will be handed over to matplotlib’s
plot
command. This can be used to set plot properties such as thecolor
.
Returns: axes – The
Axes
instance 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: - times (
-
brian2tools.plotting.data.
plot_rate
(times, rate, time_unit=<Mock name='mock.ms' id='140273157208272'>, rate_unit=<Mock name='mock.Hz' id='140273243325456'>, axes=None, **kwds)[source]¶ Parameters: - times (
Quantity
) – The time points at which therate
is measured. - rate (
Quantity
) – The population rate for each time point intimes
- time_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) – TheAxes
instance used for plotting. Defaults toNone
which means that a newAxes
will be created for the plot. - kwds (dict, optional) – Any additional keywords command will be handed over to matplotlib’s
plot
command. This can be used to set plot properties such as thecolor
.
Returns: axes – The
Axes
instance 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: - times (