Skip to contents

This function converts 'neuron', 'mesh3d', or 'neuronlist' objects, which represent 3D points linked by lines in space, into data frames that describe paths compatible with ggplot2's geom_path, or geom_polygon for mesh3d objects.

Usage

ggplot2_neuron_path(x, rotation_matrix = NULL, ...)

# S3 method for class 'neuron'
ggplot2_neuron_path(x, rotation_matrix = NULL, ...)

# S3 method for class 'neuronlist'
ggplot2_neuron_path(x, rotation_matrix = NULL, ...)

# S3 method for class 'mesh3d'
ggplot2_neuron_path(x, rotation_matrix = NULL, ...)

# S3 method for class '`NULL`'
ggplot2_neuron_path(x, rotation_matrix = NULL, ...)

Arguments

x

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

rotation_matrix

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

...

Additional arguments passed to methods.

Value

A data frame with columns X, Y, Z, and group, where each group represents a continuous path in the neuron or a polygon in the mesh.

Examples

if (FALSE) { # \dontrun{
# Convert a neuron object
neuron_data <- ggplot2_neuron_path(my_neuron)

# Convert a neuronlist object
neuronlist_data <- ggplot2_neuron_path(my_neuronlist)

# Convert a mesh3d object
mesh_data <- ggplot2_neuron_path(my_mesh)
} # }