plot3d.neuron: Plot neurons in 3D using rgl library

View source: R/neuron-plot.R

plot3d.neuronR Documentation

Plot neurons in 3D using rgl library

Description

Plot neurons in 3D using rgl library

Usage

## S3 method for class 'neuron'
plot3d(
  x,
  WithLine = TRUE,
  NeuronNames = FALSE,
  WithNodes = TRUE,
  WithAllPoints = FALSE,
  WithText = FALSE,
  PlotSubTrees = TRUE,
  add = TRUE,
  col = NULL,
  soma = FALSE,
  ...
)

Arguments

x

A neuron to plot

WithLine

Whether to plot lines for all segments in neuron

NeuronNames

Logical indicating whether to label the neuron in the plot using the NeuronName field or a character vector of names.

WithNodes

Whether to plot dots for branch and end points

WithAllPoints

Whether to plot dots for all points in the neuron

WithText

Whether to label plotted points with their numeric id (see details)

PlotSubTrees

Whether to plot all sub trees when the neuron is not fully connected.

add

Whether to add the neuron to existing rgl plot rather than clearing the scene (default TRUE)

col

Colour specification (see rgl materials)

soma

Whether to plot a sphere at neuron's origin representing the soma. Either a logical value or a numeric indicating the radius (default FALSE). When soma=TRUE the radius is hard coded to 2.

...

Additional arguments passed to rgl::lines3d

Details

Note that when WithText=TRUE, the numeric identifiers plotted are raw indices into the x$d array of the neuron, not the values of the PointNo column.

Value

list of rgl plotting ids (invisibly) separated into lines, points, texts according to plot element. See rgl::plot3d for details.

See Also

plot3d.neuronlist, plot3d.dotprops, nat::plot3d, rgl::plot3d

Examples

# A new plot would have been opened if required
open3d()
plot3d(Cell07PNs[[1]],col='red')
plot3d(Cell07PNs[[2]],col='green')

# clear the current plot
clear3d()
plot3d(Cell07PNs[[2]],col='blue',add=FALSE)
# plot the number of all nodes
clear3d()
plot3d(Cell07PNs[[2]],col='red',WithText=TRUE,add=FALSE)
# include cell bodies
plot3d(Cell07PNs[3:4], col='red', soma=TRUE)
plot3d(Cell07PNs[5], col='red', soma=3)
close3d()


nat documentation built on May 29, 2024, 10:36 a.m.