tmd.view.view

Module for viewing neuronal morphologies.

Functions

all_trunks(nrn[, plane, new_fig, subplot, ...])

Generate a 2d figure of the neuron, that contains a soma and a list of trees.

all_trunks3d(nrn[, new_fig, new_axes, ...])

Generate a figure of the neuron, that contains a soma and a list of trees.

density_cloud(obj[, new_fig, subplot, ...])

View the neuron morphologies of a population as a density cloud.

neuron(nrn[, plane, new_fig, subplot, hadd, ...])

Generate a 2d figure of the neuron that contains a soma and a list of trees.

neuron3d(nrn[, new_fig, new_axes, subplot, ...])

Generate a figure of the neuron, that contains a soma and a list of trees.

polar_plot(pop[, neurite_type, bins])

Generate a polar plot of a neuron or population.

population(pop[, plane, new_fig, subplot, ...])

Generate a 2d figure of the population, that contains a soma and a list of trees.

population3d(pop[, new_fig, new_axes, subplot])

Generate a figure of the population, that contains the pop somata and a set of list of trees.

soma(sm[, plane, new_fig, subplot, hadd, vadd])

Generate a 2d figure of the soma.

soma3d(sm[, new_fig, new_axes, subplot])

Generate a 3d figure of the soma.

tree(tr[, plane, new_fig, subplot, hadd, vadd])

Generate a 2d figure of the tree.

tree3d(tr[, new_fig, new_axes, subplot])

Generate a figure of the tree in 3d.

tree_barcode_colors(tr[, plane, feature, cmap])

Generates a two panel figure with color-coded branches, bars.

tree_full_persistence_colors(tr[, plane, ...])

Generates a four panel figure with color-coded branches, bars.

trunk(tr[, plane, new_fig, subplot, hadd, ...])

Generate a 2d figure of the trunk = first N segments of the tree.

trunk3d(tr[, new_fig, new_axes, subplot, N])

Generate a figure of the trunk in 3d.

tmd.view.view.all_trunks(nrn, plane='xy', new_fig=True, subplot=False, hadd=0.0, vadd=0.0, neurite_type='all', N=10, **kwargs)

Generate a 2d figure of the neuron, that contains a soma and a list of trees.

Parameters:
  • nrn (Neuron) – A Neuron object.

  • plane (str) – Accepted values: Any sorted pair of xyz. Default value is ‘xy’.

  • new_fig (bool) – Defines if the neuron will be plotted in the current figure (False) or in a new figure (True). Default value is True.

  • subplot (matplotlib subplot value or False) – If False the default subplot 111 will be used. For any other value a matplotlib subplot will be generated. Default value is False.

  • hadd (float) – X shift.

  • vadd (float) – Y shift.

  • neurite_type (str) – The types of neurites that should be plotted.

  • N (float) – Half of the window size used if xlim and ylim are not given.

Keyword Arguments:

**kwargs – All keyword arguments will be passed to tmd.view.common.plot_style().

Returns:

A 3D matplotlib figure with a tree view, at the selected plane.

tmd.view.view.all_trunks3d(nrn, new_fig=True, new_axes=True, subplot=False, neurite_type='all', N=10, **kwargs)

Generate a figure of the neuron, that contains a soma and a list of trees.

Parameters:
  • neuron (Neuron) – A Neuron object.

  • new_fig (bool) – Defines if the neuron will be plotted in the current figure (False) or in a new figure (True).

  • new_axes (bool) – Defines if the neuron will be plotted in the current axes (False) or in new axes (True).

  • subplot (matplotlib subplot value or False) – If False the default subplot 111 will be used. For any other value a matplotlib subplot will be generated. Default value is False.

  • neurite_type (str) – The types of neurites that should be plotted.

  • N (float) – Half of the window size used if xlim and ylim are not given.

Keyword Arguments:

**kwargs – All keyword arguments will be passed to tmd.view.common.plot_style().

Returns:

A 3D matplotlib figure with a tree view.

tmd.view.view.density_cloud(obj, new_fig=True, subplot=111, new_axes=True, neurite_type='all', bins=100, plane='xy', color_map=<matplotlib.colors.LinearSegmentedColormap object>, alpha=0.8, centered=True, colorbar=True, plot_neuron=False, **kwargs)

View the neuron morphologies of a population as a density cloud.

tmd.view.view.neuron(nrn, plane='xy', new_fig=True, subplot=False, hadd=0.0, vadd=0.0, neurite_type='all', apical_alignment=False, plot_soma=True, new_axes=True, **kwargs)

Generate a 2d figure of the neuron that contains a soma and a list of trees.

Parameters:
  • nrn (Neuron) – A neuron object.

  • plane (str) – Accepted values: Any sorted pair of xyz. Default value is ‘xy’.

  • new_fig (bool) – Defines if the neuron will be plotted in the current figure (False) or in a new figure (True). Default value is True.

  • subplot (bool) – Create a subplot if set to True.

  • hadd (float) – X shift. Default value is 0.

  • vadd (float) – Y shift. Default value is 0.

  • neurite_type (str) – The types of neurites that should be plotted. Default value is ‘all’.

  • apical_alignment (bool) – Defines if the neuron will be automatically aligned toward the pia. Default value is False.

  • plot_soma (bool) – Defines if the soma will be plotted. Default value is True.

  • new_axes (bool) – Defines if the neuron will be plotted in the current axes (False) or in new axes (True). Default value is True.

Keyword Arguments:

**kwargs – All keyword arguments will be passed to tmd.view.view.soma(), tmd.view.view.tree() and tmd.view.common.plot_style().

Returns:

A 3D matplotlib figure with a tree view, at the selected plane.

tmd.view.view.neuron3d(nrn, new_fig=True, new_axes=True, subplot=False, neurite_type='all', **kwargs)

Generate a figure of the neuron, that contains a soma and a list of trees.

Parameters:
  • neuron (Neuron) – A Neuron object.

  • new_fig (bool) – Defines if the neuron will be plotted in the current figure (False) or in a new figure (True).

  • new_axes (bool) – Defines if the neuron will be plotted in the current axes (False) or in new axes (True).

  • subplot (matplotlib subplot value or False) – If False the default subplot 111 will be used. For any other value a matplotlib subplot will be generated. Default value is False.

  • neurite_type (str) – The types of neurites that should be plotted.

Keyword Arguments:

**kwargs – All keyword arguments will be passed to tmd.view.common.plot_style().

Returns:

A 3D matplotlib figure with a tree view.

tmd.view.view.polar_plot(pop, neurite_type='neurites', bins=20)

Generate a polar plot of a neuron or population.

tmd.view.view.population(pop, plane='xy', new_fig=True, subplot=False, hadd=0.0, vadd=0.0, neurite_type='all', **kwargs)

Generate a 2d figure of the population, that contains a soma and a list of trees.

Parameters:
  • pop (Population) – A Population object.

  • plane (str) – Accepted values: Any sorted pair of xyz. Default value is ‘xy’.

  • new_fig (bool) – Defines if the neuron will be plotted in the current figure (False) or in a new figure (True).

  • subplot (matplotlib subplot value or False) – If False the default subplot 111 will be used. For any other value a matplotlib subplot will be generated. Default value is False.

  • hadd (float) – X shift.

  • vadd (float) – Y shift.

  • neurite_type (str) – The types of neurites that should be plotted.

  • N (float) – Half of the window size used if xlim and ylim are not given.

Keyword Arguments:

**kwargs – All keyword arguments will be passed to soma(), tree() and tmd.view.common.plot_style().

Returns:

A 3D matplotlib figure with a tree view, at the selected plane.

tmd.view.view.population3d(pop, new_fig=True, new_axes=True, subplot=False, **kwargs)

Generate a figure of the population, that contains the pop somata and a set of list of trees.

Parameters:
  • pop (Population) – A Population object.

  • new_fig (bool) – Defines if the neuron will be plotted in the current figure (False) or in a new figure (True).

  • new_axes (bool) – Defines if the neuron will be plotted in the current axes (False) or in new axes (True).

  • subplot (matplotlib subplot value or False) – If False the default subplot 111 will be used. For any other value a matplotlib subplot will be generated. Default value is False.

Keyword Arguments:

**kwargs – All keyword arguments will be passed to tmd.view.common.plot_style().

Returns:

A 3D matplotlib figure with a population view.

tmd.view.view.soma(sm, plane='xy', new_fig=True, subplot=False, hadd=0.0, vadd=0.0, **kwargs)

Generate a 2d figure of the soma.

Parameters:
  • sm (Soma) – A Soma object.

  • plane (str) – The plane to consider.

  • new_fig (bool) – Create a new figure if set to True.

  • subplot (bool) – Create a subplot if set to True.

  • hadd (float) – X shift.

  • vadd (float) – Y shift.

tmd.view.view.soma3d(sm, new_fig=True, new_axes=True, subplot=False, **kwargs)

Generate a 3d figure of the soma.

Parameters:
  • soma (Soma) – A Soma object.

  • new_fig (bool) – Defines if the neuron will be plotted in the current figure (False) or in a new figure (True).

  • new_axes (bool) – Defines if the neuron will be plotted in the current axes (False) or in new axes (True).

  • subplot (matplotlib subplot value or False) – If False the default subplot 111 will be used. For any other value a matplotlib subplot will be generated. Default value is False.

Keyword Arguments:

**kwargs – All keyword arguments will be passed to tmd.view.common.plot_style().

Returns:

A 3D matplotlib figure with a tree view.

tmd.view.view.tree(tr, plane='xy', new_fig=True, subplot=False, hadd=0.0, vadd=0.0, **kwargs)

Generate a 2d figure of the tree.

Parameters:
  • tr (Tree) – A Tree object.

  • plane (str) – The plane to consider.

  • new_fig (bool) – Create a new figure if set to True.

  • subplot (bool) – Create a subplot if set to True.

  • hadd (float) – X shift.

  • vadd (float) – Y shift.

tmd.view.view.tree3d(tr, new_fig=True, new_axes=True, subplot=False, **kwargs)

Generate a figure of the tree in 3d.

Parameters:
  • tr (Tree) – A Tree object.

  • new_fig (bool) – Defines if the neuron will be plotted in the current figure (False) or in a new figure (True).

  • new_axes (bool) – Defines if the neuron will be plotted in the current axes (False) or in new axes (True).

  • subplot (matplotlib subplot value or False) – If False the default subplot 111 will be used. For any other value a matplotlib subplot will be generated. Default value is False.

Keyword Arguments:

**kwargs – All keyword arguments will be passed to tmd.view.common.plot_style().

Returns:

A 3D matplotlib figure with a tree view.

tmd.view.view.tree_barcode_colors(tr, plane='xy', feature='path_distances', cmap=<matplotlib.colors.LinearSegmentedColormap object>)

Generates a two panel figure with color-coded branches, bars.

Generates a 2d pic of the tree, each branch has a unique color. A persistence barcode with the same colors at each bar.

Parameters:
  • tr (Tree) – A Tree object.

  • plane (str) – Accepted values: Any sorted pair of xyz: (xy, xz, yx, yz, zx, zy) Default value is ‘xy’.

  • feature (str) – Accepted values: path_distances, radial_distances. Default value is ‘path_distances’.

  • cmap (matplotlib colormap) – Default value is jet.

Returns:

2d matplotlib figure, axes.

tmd.view.view.tree_full_persistence_colors(tr, plane='xy', feature='path_distances', cmap=<matplotlib.colors.LinearSegmentedColormap object>)

Generates a four panel figure with color-coded branches, bars.

Generates a 2d pic of the tree, each branch has a unique color. A persistence barcode with the same colors at each bar, A persistence diagram with the same colors, A persistence image with the same colormap.

Parameters:
  • tr (Tree) – A Tree object.

  • plane (str) – Accepted values: Any sorted pair of xyz: (xy, xz, yx, yz, zx, zy) Default value is ‘xy’.

  • feature (str) – Accepted values: path_distances, radial_distances. Default value is ‘path_distances’.

  • cmap (matplotlib colormap) – Default value is jet.

Returns:

2d matplotlib figure, axes.

tmd.view.view.trunk(tr, plane='xy', new_fig=True, subplot=False, hadd=0.0, vadd=0.0, N=10, **kwargs)

Generate a 2d figure of the trunk = first N segments of the tree.

Parameters:
  • tr (Tree) – A Tree object.

  • plane (str) – The plane to consider.

  • new_fig (bool) – Create a new figure if set to True.

  • subplot (bool) – Create a subplot if set to True.

  • hadd (float) – X shift.

  • vadd (float) – Y shift.

  • N (int) – Number of segments.

tmd.view.view.trunk3d(tr, new_fig=True, new_axes=True, subplot=False, N=10, **kwargs)

Generate a figure of the trunk in 3d.

Parameters:
  • tr (Tree) – A Tree object.

  • new_fig (bool) – Defines if the neuron will be plotted in the current figure (False) or in a new figure (True).

  • new_axes (bool) – Defines if the neuron will be plotted in the current axes (False) or in new axes (True).

  • subplot (matplotlib subplot value or False) – If False the default subplot 111 will be used. For any other value a matplotlib subplot will be generated. Default value is False.

  • N (int) – The number of segments to plot.

Keyword Arguments:

**kwargs – All keyword arguments will be passed to tmd.view.common.plot_style().

Returns:

A 3D matplotlib figure with a tree view.