brian2tools.plotting.synapses module¶
Module to plot synaptic connections.
- brian2tools.plotting.synapses.plot_synapses(sources, targets, values=None, var_unit=None, var_name=None, plot_type='scatter', axes=None, **kwds)[source]¶
- Parameters:
sources (
ndarrayof int) – The source indices of the connections (as returned bySynapses.i).targets (
ndarrayof int) – The target indices of the connections (as returned bySynapses.j).values (
Quantity,ndarray) – The values to plot, a 1D array of the same size assourcesandtargets.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.
plot_type ({
'scatter','image','hexbin'}, optional) – What type of plot to use. Can be'scatter'(the default) to draw a scatter plot,'image'to display the connections as a matrix or'hexbin'to display a 2D histogram using matplotlib’shexbinfunction. For a large number of synapses,'scatter'will be very slow. Similarly, an'image'plot will use a lot of memory for connections between two large groups. For a small number of neurons and synapses,'hexbin'will be hard to interpret.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 the respective matplotlib command (
scatterif theplot_typeis'scatter',imshowfor'image', andhexbinfor'hexbin'). This can be used to set plot properties such as themarker.
- 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: