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]
  • sources (ndarray of int) – The source indices of the connections (as returned by Synapses.i).
  • targets (ndarray of int) – The target indices of the connections (as returned by Synapses.j).
  • values (Quantity, ndarray) – The values to plot, a 1D array of the same size as sources and targets.
  • var_unit (Unit, optional) – The unit to use to plot the values (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 the values.
  • 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’s hexbin function. 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) – The Axes instance used for plotting. Defaults to None which means that a new Axes will be created for the plot.
  • kwds (dict, optional) – Any additional keywords command will be handed over to the respective matplotlib command (scatter if the plot_type is 'scatter', imshow for 'image', and hexbin for 'hexbin'). This can be used to set plot properties such as the marker.

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: