plotSpatial: Plot spatial components from Steps 2 or 3 of SCALPEL.

Description Usage Arguments Details Value See Also Examples

View source: R/SCALPEL_graphics.R

Description

We plot the dictionary elements obtained from Step 2 of SCALPEL, or the filtered dictionary elements from Step 3 of SCALPEL.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
plotSpatial(
  scalpelOutput = NULL,
  neuronSet = "",
  neuronsToDisplay = NULL,
  colVec = NULL,
  title = "",
  fileName = NULL,
  pctTransp = 0.7,
  number = TRUE,
  addToPlot = FALSE,
  border = FALSE,
  zoom = FALSE,
  A = NULL,
  videoHeight = NULL
)

Arguments

scalpelOutput

An object returned by one of these SCALPEL functions: scalpel, scalpelStep2, or scalpelStep3.

neuronSet

Which set of neurons should be plotted: use "A" for the dictionary elements resulting from scalpelStep2 and saved as scalpelOutput$A, or use "Afilter" for the filtered dictionary elements resulting from scalpelStep3 and saved as scalpelOutput$Afilter.

neuronsToDisplay

Vector giving which neurons' spatial components to plot. The indices refer to which columns to plot of scalpelOutput$Afilter (if neuronSet="Afilter"), or scalpelOutput$A (if neuronSet="A"). By default, all components are plotted. Users may also specify "kept", which will exclude all dictionary elements discarded using a previous call to reviewNeurons or reviewNeuronsInteractive.

colVec

Vector of colors to use, which are chosen automatically if the default value of NULL is used.

title

Label for the title.

fileName

If provided, the plot will be saved to the specified location.

pctTransp

The percent transparency (in [0,1]) for the colors used to plot the neurons. The default value is 0.7.

number

Logical value indicating whether the neurons should be numbered.

addToPlot

Logical value indicating whether these neurons should be plotted to an existing plot.

border

Logical value indicating whether only the borders of the neurons should be plotted.

zoom

Logical value indicating whether the plot should be zoomed in to exclude any area not containing neurons.

A

Optional advanced user argument: A matrix containing the spatial components to plot, where the ith column of A is a vector of 1's and 0's, indicating whether each pixel is contained in the ith spatial component. By default, this argument is ignored and the dictionary elements saved in scalpelOutput$A or scalpelOutput$Afilter are plotted. If A is provided, scalpelOutput will be ignored and neuronsToDisplay will refer to the columns of A.

videoHeight

The height of the video (in pixels). This only needs to be specified if the user is plotting A.

Details

When neuronSet="Afilter", spatial components corresponding to temporal components that were zeroed out in the sparse group lasso are plotted in gray, unless colVec is specified by the user.

Value

None

See Also

scalpelStep2, scalpelStep3, scalpel, plotResults

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
### many of the functions in this package are interconnected so the
### easiest way to learn to use the package is by working through the vignette,
### which is available at ajpete.com/software

#assumes you have run the example for the "scalpel" function

#simplest example with default parameters:
plotSpatial(scalpelOutput = scalpelOutput, neuronSet = "Afilter")

#example with optional parameters:
#plot only two of the neurons, add a title, do not number neurons,
#and draw the outlines of the neurons
plotSpatial(scalpelOutput = scalpelOutput, neuronsToDisplay = c(1,2), neuronSet = "Afilter",
           title = "First two neurons", number = FALSE, border = TRUE)

## End(Not run)

scalpel documentation built on Feb. 3, 2021, 9:05 a.m.