Skip to contents

This function creates a ggplot2 geom layer for visualizing neuron objects. It supports 'neuron', 'neuronlist', and 'mesh3d' objects.

Usage

geom_neuron(
  x,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'neuron'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'neuronlist'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'mesh3d'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'hxsurf'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class '`NULL`'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'list'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'matrix'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'data.frame'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'dotprops'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'synapticneuron'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

# S3 method for class 'splitneuron'
geom_neuron(
  x = NULL,
  rotation_matrix = NULL,
  root = 3,
  cols = c("navy", "turquoise"),
  stat = "identity",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = FALSE,
  ...
)

Arguments

x

A 'neuron', 'neuronlist', or 'mesh3d' object to be visualized.

rotation_matrix

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

root

Numeric, if >0 and x is or contains neuron objects, then the root node is plotted as a dot of size root. If FALSE or 0 no root node is plotted.

cols

The color to plot the neurons in. If length(cols)==length(x) each neuron will be coloured by its index in x applied to cols.

stat

The statistical transformation to use on the data for this layer.

position

Position adjustment, either as a string, or the result of a call to a position adjustment function.

na.rm

If FALSE, the default, missing values are removed with a warning. If TRUE, missing values are silently removed.

show.legend

logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped.

inherit.aes

If FALSE, overrides the default aesthetics, rather than combining with them.

...

Other arguments passed on to layer().

Value

A list of ggplot2 geom layers for visualizing the neuron.

Examples

if (FALSE) { # \dontrun{
library(ggplot2)
ggplot() + geom_neuron(nat::Cell07PNs[[1]], root = 10)
ggplot() + geom_neuron(nat::Cell07PNs)
ggplot() + geom_neuron(nat::MBL.surf)
} # }