Skip to contents

This function creates a complete ggplot2 visualisation for neuron objects, including 'neuron', 'neuronlist', 'mesh3d', and 'hxsurf' objects. It sets up a minimal theme and applies consistent styling to the plot.

Usage

ggneuron(
  x,
  volume = NULL,
  info = NULL,
  rotation_matrix = NULL,
  cols1 = c("turquoise", "navy"),
  cols2 = c("grey75", "grey50"),
  alpha = 0.5,
  title.col = "darkgrey",
  ...
)

Arguments

x

A 'neuron', 'neuronlist', 'mesh3d', or 'hxsurf' object to be visualised.

volume

a brain/neuropil volume to be plotted in grey, for context. Defaults to NULL, no volume plotted.

info

Optional. A string to be used as the plot title.

rotation_matrix

An optional 4x4 rotation matrix to apply to the neuron coordinates.

cols1

Colour for the lowest Z values. Default is "turquoise".

cols2

Colour for the highest Z values. Default is "navy".

alpha

Transparency of the neuron visualisation. Default is 0.5.

title.col

Colour of the plot title. Default is "darkgrey".

...

Additional arguments passed to geom_neuron().

Value

A ggplot2 object representing the neuron visualisation.

Details

This function wraps around geom_neuron() to create a complete plot with a consistent, minimal theme. It removes axes, legends, and other extraneous elements to focus on the neuron visualisation itself.

References

Jefferis, G. S. X. E., Potter, C. J., Chan, A. M., Marin, E. C., Rohlfing, T., Maurer, C. R., & Luo, L. (2007). Comprehensive maps of Drosophila higher olfactory centers: Spatially segregated fruit and pheromone representation. Cell, 128(6), 1187-1203. doi:10.1016/j.cell.2007.01.040

Schneider-Mizell, C. M., Gerhard, S., Longair, M., Kazimiers, T., Li, F., Zwart, M. F., Champion, A., Midgley, F. M., Fetter, R. D., Saalfeld, S., & Cardona, A. (2016). Quantitative neuroanatomy for connectomics in Drosophila. eLife, 5, e12059. doi:10.7554/eLife.12059

See also

geom_neuron for the underlying geom used in this function.

Examples

if (FALSE) { # \dontrun{
library(nat.ggplot)

# Visualise neurons with brain volume as context
ggneuron(banc.skels,
         volume = banc.brain_neuropil,
         rotation_matrix = banc_view)

# Visualise the brain neuropil alone
ggneuron(banc.brain_neuropil,
         rotation_matrix = banc_view,
         cols1 = c("lightblue", "darkblue"))

# Visualise split neurons with custom colours
ggneuron(banc.neurons.flow,
         volume = banc.brain_neuropil,
         rotation_matrix = banc_view,
         info = "LHPD2a1 neurons with axon/dendrite split")

# Visualise neuron meshes
ggneuron(banc.meshes[[1]],
         rotation_matrix = banc_view,
         cols1 = c("purple", "magenta"),
         alpha = 0.8)
} # }