Plotting
Most plotting should be done with the PyLab commands, all of
which are loaded when you import Brian. See:
for help on PyLab.
Brian currently defines just two plotting functions of its own,
raster_plot() and hist_plot().
-
brian.raster_plot(*monitors, **additionalplotoptions)
Raster plot of a SpikeMonitor
Usage
- raster_plot(monitor,options...)
- Plots the spike times of the monitor
on the x-axis, and the neuron number on the y-axis
- raster_plot(monitor0,monitor1,...,options...)
- Plots the spike times
for all the monitors given, with y-axis defined by placing a spike
from neuron n of m in monitor i at position i+n/m
- raster_plot(options...)
- Guesses the monitors to plot automagically
Options
Any of PyLab options for the plot command can be given, as well as:
- showplot=False
- set to True to run pylab’s show() function
- newfigure=False
- set to True to create a new figure with pylab’s figure() function
- xlabel
- label for the x-axis
- ylabel
- label for the y-axis
- title
- title for the plot
- showgrouplines=False
- set to True to show a line between each monitor
- grouplinecol
- colour for group lines
- spacebetweengroups
- value between 0 and 1 to insert a space between
each group on the y-axis
- refresh
- Specify how often (in simulation time) you would like the plot to
refresh. Note that this will only work if pylab is in interactive mode,
to ensure this call the pylab ion() command.
- showlast
- If you are using the refresh option above, plots are much quicker
if you specify a fixed time window to display (e.g. the last 100ms).
- redraw
- If you are using more than one realtime monitor, only one of them needs
to issue a redraw command, therefore set this to False for all but
one of them.
Note that with some IDEs, interactive plotting will not work with the
default matplotlib backend, try doing something like this at the
beginning of your script (before importing brian):
import matplotlib
matplotlib.use('WXAgg')
You may need to experiment, try WXAgg, GTKAgg, QTAgg, TkAgg.
-
brian.hist_plot(histmon=None, **plotoptions)
Plot a histogram
Usage
- hist_plot(histmon,options...)
- Plot the given histogram monitor
- hist_plot(options...)
- Guesses which histogram monitor to use
with argument:
- histmon
- is a monitor of histogram type
Notes
Plots only the first n-1 of n bars in the histogram, because
the nth bar is for the interval (-,infinity).
Options
Any of PyLab options for bar can be given, as well as:
- showplot=False
- set to True to run pylab’s show() function
- newfigure=True
- set to False not to create a new figure with pylab’s figure() function
- xlabel
- label for the x-axis
- ylabel
- label for the y-axis
- title
- title for the plot