The plot module

dense.plot.plot_dendrogram(neurite[, axis, ...])

Plot the dendrogram of a neurite.

dense.plot.plot_environment([culture, ...])

Plot the environment in which the neurons grow.

dense.plot.plot_neurons([gid, mode, ...])

Plot neurons in the network.

dense.plot.plot_recording(recorder[, ...])

Plot the result of a recording.

Plotting module

dense.plot.plot_dendrogram(neurite, axis=None, show_node_id=False, aspect_ratio=None, vertical_diam_frac=0.2, ignore_diameter=False, show=True, **kwargs)[source]

Plot the dendrogram of a neurite.

Parameters
  • neurite (Neurite object) – Neurite for which the dendrogram should be plotted.

  • axis (matplotlib.Axes.axis object, optional (default: new one)) – Axis on which the dendrogram should be plotted.

  • show (bool, optional (default: True)) – Whether the figure should be shown right away.

  • show_node_id (bool, optional (default: False)) – Display each node number on the branching points.

  • aspect_ratio (float, optional (default: variable)) – Whether to use a fixed aspect ratio. Automatically set to 1 if show_node_id is True.

  • vertical_diam_frac (float, optional (default: 0.2)) – Fraction of the vertical spacing taken by the branch diameter.

  • ignore_diameter (bool, optional (default: False)) – Plot all the branches with the same width.

  • **kwargs (arguments for matplotlib.patches.Rectangle) – For instance facecolor or edgecolor.

Returns

Return type

The axis on which the plot was done.

dense.plot.plot_environment(culture=None, title='Environment', ax=None, m='', mc='#999999', fc='#ccccff', ec='#444444', alpha=0.5, brightness='height', show=True, **kwargs)[source]

Plot the environment in which the neurons grow.

Parameters
  • culture (Shape, optional (default: None)) – Shape of the environment; if the environment was already set using CreateEnvironment()

  • title (str, optional (default: 'Shape')) – Title of the plot.

  • ax (matplotlib.axes.Axes, optional (default: new axis)) – Optional existing axis on which the environment should be added.

  • m (str, optional (default: invisible)) – Marker to plot the shape’s vertices, matplotlib syntax.

  • mc (str, optional (default: "#999999")) – Color of the markers.

  • fc (str, optional (default: "#8888ff")) – Color of the shape’s interior.

  • ec (str, optional (default: "#444444")) – Color of the shape’s edges.

  • alpha (float, optional (default: 0.5)) – Opacity of the shape’s interior.

  • brightness (str, optional (default: height)) – Show how different other areas are from the ‘default_area’ (lower values are darker, higher values are lighter). Difference can concern the ‘height’, or any of the properties of the Area objects.

  • show (bool, optional (default: False)) – If True, the plot will be displayed immediately.

dense.plot.plot_neurons(gid=None, mode=None, show_nodes=False, show_active_gc=True, culture=None, show_culture=True, aspect=1.0, soma_radius=None, active_gc='d', gc_size=2.0, soma_color='k', scale=<Quantity(50, 'micrometer')>, scale_text=True, axon_color='indianred', dendrite_color='royalblue', subsample=1, save_path=None, title=None, axis=None, show_density=False, dstep=20.0, dmin=None, dmax=None, colorbar=True, show_neuron_id=False, show=True, xy_steps=None, x_min=None, x_max=None, y_min=None, y_max=None, **kwargs)[source]

Plot neurons in the network.

Parameters
  • gid (int or list, optional (default: all neurons)) – Id(s) of the neuron(s) to plot.

  • mode (str, optional (default: "sticks")) – How to draw the neurons. By default, the “sticks” mode shows the real width of the neurites. Switching to “lines” only leaves the trajectory of the growth cones, without information about the neurite width. Eventually, the “mixed” mode shows both informations superimposed.

  • culture (Shape, optional (default: None)) – Shape of the environment; if the environment was already set using CreateEnvironment().

  • show_nodes (bool, optional (default: False)) – Show the branching nodes.

  • show_active_gc (bool, optional (default: True)) – If True, display the tip (growth cone) of actively growing branches.

  • show_culture (bool, optional (default: True)) – If True, displays the culture in which the neurons are embedded.

  • aspect (float, optional (default: 1.)) – Set the aspect ratio between the x and y axes.

  • soma (str, optional (default: "o")) – Shape of the soma marker using the matplotlib conventions.

  • soma_radius (float, optional (default: real neuron radius)) – Size of the soma marker.

  • active_gc (str, optional (default: "d")) – Shape of the active growth cone marker using the matplotlib conventions.

  • gc_size (float, optional (default: 2.)) – Size of the growth cone marker.

  • axon_color (valid matplotlib color, optional (default: "indianred")) – Color of the axons.

  • dendrite_color (valid matplotlib color, optional (default: "royalblue")) – Color of the dendrites.

  • soma_color (valid matplotlib color, optional (default: "k")) – Color of the soma.

  • scale (length, optional (default: 50 microns)) – Whether a scale bar should be displayed, with axes hidden. If None, then spatial measurements will be given through standard axes.

  • subsample (int, optional (default: 1)) – Subsample the neurites to save memory.

  • save_path (str, optional (default: not saved)) – Path where the plot should be saved, including the filename, pdf only.

  • title (str, optional (default: no title)) – Title of the plot.

  • axis (matplotlib.pyplot.Axes, optional (default: None)) – Axis on which the plot should be drawn, otherwise a new one will be created.

  • show_neuron_id (bool, optional (default: False)) – Whether the GID of the neuron should be displayed inside the soma.

  • show (bool, optional (default: True)) – Whether the plot should be displayed immediately or not.

  • dstep (number of bins for density level histogram) –

  • dmin (minimal density for density histogram) –

  • dmax (maximal scale for density) –

  • xy_steps (number of spatial bins for density plot) –

  • x_min (bounding bix for spatial density map) –

  • x_max (bounding bix for spatial density map) –

  • y_min (bounding bix for spatial density map) –

  • y_max (bounding bix for spatial density map) –

  • **kwargs (optional arguments) – Details on how to plot the environment, see plot_environment().

Returns

axes

Return type

axis or tuple of axes if density is True.

dense.plot.plot_recording(recorder, time_units='hours', display='overlay', cmap=None, legend=True, show=True, **kwargs)[source]

Plot the result of a recording.

Parameters
  • recorder (int or tuple of ints) – Gid of the recorder(s).

  • time_units (str, optional (default: hours)) – Unit for the time, among “seconds”, “minutes”, “hours”, and “days”.

  • display (str, optional (default: "overlay")) – How to display the recordings for several neurons. By default, all neurons are plotted on the same axes. For a reasonnable number of neurons, the “separate” options can be used instead, where the recordings of each neuron will be plotted on a separate subplot.

  • cmap (colormap, optional (default: matplotlib's default)) – Colormap which should be use when plotting different neurons or bservables simultaneously.

  • legend (bool, optional (default: True)) – Whether to display the legend or not.

  • show (bool, optional (default: True)) – Display the plot.

  • **kwargs (optional arguments) – Include “color” (numbers) and “linestyle” (default matplotlib values) to customize the plot’s appearance. Must be iterables.

Returns

axes – The axes of the plots.

Return type

dict