brian2tools.plotting.base module¶
Base module for the plotting facilities.
- brian2tools.plotting.base.add_background_pattern(axes, hatch='xxx', fill=True, fc=(0.9, 0.9, 0.9), ec=(0.8, 0.8, 0.8), zorder=-10, **kwds)[source]¶
Add a “hatching” pattern to the background of the axes (can be useful to make a difference between “no value” and a value mapped to a color value that is identical to the background color). By default, it uses a cross hatching pattern in gray which can be changed by providing the respective arguments. All additional keyword arguments are passed on to the
Rectangleinitializer.- Parameters:
axes (
matplotlib.axes.Axes) – The axes where the background pattern should be added.hatch (str, optional) – See
matplotlib.patches.Patch.set_hatch. Defaults to'xxx'.fill (bool, optional) – See
matplotlib.patches.Patch.set_fill. Defaults toTrue.fc (mpl color spec or None or 'none') – See
matplotlib.patches.Patch.set_facecolor. Defaults to(0.9, 0.9, 0.9).ec (mpl color spec or None or 'none') – See
matplotlib.patches.Patch.set_edgecolor. Defaults to(0.8, 0.8, 0.8).zorder (int) – See
matplotlib.artist.Artist.set_zorder. Defaults to-10.
- brian2tools.plotting.base.brian_plot(brian_obj, axes=None, **kwds)[source]¶
Plot the data of the given object (e.g. a monitor). This function will call an adequate plotting function for the object, e.g.
plot_rasterfor aSpikeMonitor. The plotting may apply heuristics to get a generally useful plot (e.g. for aPopulationRateMonitor, it will plot the rates smoothed with a Gaussian window of 1 ms), the exact details are subject to change. This function is therefore mostly meant as a quick and easy way to plot an object, for full control use one of the specific plotting functions.When a
StateMonitorthat records several variables is given, a column of subplots sharing the time axis is created automatically.- Parameters:
brian_obj (object) – The Brian object to plot.
axes (
Axesor array-like of Axes, optional) – TheAxesinstance used for plotting. Defaults toNonewhich means that a newAxeswill be created for the plot. For a multi-variableStateMonitor, pass an array-like ofAxeswith one entry per recorded variable.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.For multi-variable
StateMonitorobjects,var_nameandvar_unitmay be dictionaries keyed by variable name, e.g.var_name={'v': 'membrane potential', 'I': 'input current'}.
- Returns:
axes – The
Axesinstance(s) used for plotting. A list is returned when multiple state variables are plotted.- Return type: