brian2tools.plotting.morphology module¶
Module to plot Brian Morphology objects.
- brian2tools.plotting.morphology.plot_dendrogram(morphology, axes=None, **kwds)[source]¶
Plot a “dendrogram” of a morphology, i.e. an abstract representation which visualizes the branching structure and the length of each section.
- Parameters:
morphology (
Morphology) – The morphology to visualize.axes (
Axes, optional) – TheAxesinstance used for plotting. Defaults toNonewhich means that a newAxeswill be created for the plot.**kwds – Any additional keyword arguments are passed to matplotlib’s
plot,vlines, andhlinescalls. Only arguments accepted by all three functions should be used (e.g.color,alpha,linewidth).
- 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:
- brian2tools.plotting.morphology.plot_morphology(morphology, plot_3d=None, show_compartments=False, show_diameter=False, colors=('darkblue', 'darkred'), values=None, value_norm=(None, None), value_colormap='hot', value_colorbar=True, value_unit=None, axes=None)[source]¶
Plot a given
Morphologyin 2D or 3D.- Parameters:
morphology (
Morphology) – The morphology to plotplot_3d (bool, optional) – Whether to plot the morphology in 3D or in 2D. If not set (the default) a morphology where all z values are 0 is plotted in 2D, otherwise it is plot in 3D.
show_compartments (bool, optional) – Whether to plot a dot at the center of each compartment. Defaults to
False.show_diameter (bool, optional) – Whether to plot the compartments with the diameter given in the morphology. Defaults to
False.colors (sequence of color specifications) – A list of colors that is cycled through for each new section. Can be any color specification that matplotlib understands (e.g. a string such as
'darkblue'or a tuple such as(0, 0.7, 0).values (Quantity, optional) – Values to fill compartment patches with a color that corresponds to their given value.
value_norm (tuple or callable, optional) – Normalization function to scale the displayed values. Can be a tuple of a minimum and a maximum value (where either of them can be
Noneto denote taking the minimum/maximum from the data) or a function that takes a value and returns the scaled value (e.g. as returned bymatplotlib.colors.PowerNorm). For a tuple of values, will usematplotlib.colors.Normalize```(vmin, vmax, clip=True)``with the given(vmin, vmax)values.value_colormap (str or matplotlib.colors.Colormap, optional) – Desired colormap for plots. Either the name of a standard colormap or a
matplotlib.colors.Colormapinstance. Defaults to'hot'. Note that this usesmatplotlibcolor maps even for 3D plots with Mayavi.value_colorbar (bool or dict, optional) – Whether to add a colorbar for the
values. Defaults toTrue, but will be ignored if novaluesare provided. Can also be a dictionary with the keyword arguments for matplotlib’scolorbarmethod (2D plot), or for Mayavi’sscalarbarmethod (3D plot).value_unit (
Unit, optional) – AUnitto rescale the values for display in the colorbar. Does not have any visible effect if no colorbar is used. If not specified, will try to determine the “best unit” to itself.axes (
AxesorScene, optional) – A matplotlibAxes(for 2D plots) or mayaviScene( for 3D plots) instance, where the plot will be added.
- Returns:
axes – The
AxesorSceneinstance 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: