brian2tools.plotting.morphology module

Module to plot Brian Morphology objects.

brian2tools.plotting.morphology.plot_morphology(morphology, plot_3d=None, show_compartments=False, show_diameter=False, colors=('darkblue', 'darkred'), axes=None)[source]

Plot a given Morphology in 2D or 3D.

Parameters:
  • morphology (Morphology) – The morphology to plot
  • plot_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).
  • axes (Axes or Scene, optional) – A matplotlib Axes (for 2D plots) or mayavi Scene ( for 3D plots) instance, where the plot will be added.
Returns:

axes – The Axes or Scene 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:

Axes or Scene

brian2tools.plotting.morphology.plot_dendrogram(morphology, axes=None)[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) – The Axes instance used for plotting. Defaults to None which means that a new Axes will be created for the plot.
Returns:

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:

Axes