plot,NeuroSlice-method | R Documentation |
Creates a 2D visualization of a NeuroSlice
object using ggplot2
.
## S4 method for signature 'NeuroSlice'
plot(
x,
cmap = gray(seq(0, 1, length.out = 255)),
irange = range(x, na.rm = TRUE)
)
## S4 method for signature 'NeuroVol'
plot(
x,
cmap = gray(seq(0, 1, length.out = 255)),
zlevels = unique(round(seq(1, dim(x)[3], length.out = 6))),
irange = range(x, na.rm = TRUE),
thresh = c(0, 0),
alpha = 1,
bgvol = NULL,
bgcmap = gray(seq(0, 1, length.out = 255))
)
x |
the object to display |
cmap |
a color map consisting of a vector of colors in hex format (e.g. |
irange |
the intensity range indicating the low and high values of the color scale. |
zlevels |
the series of slice indices to display. |
thresh |
a 2-element vector indicating the lower and upper transparency thresholds. |
alpha |
the level of alpha transparency |
bgvol |
a background volume that serves as an image underlay (currently ignored). |
bgcmap |
a color map for backround layer consisting of a vector of colors in hex format (e.g. |
... |
Additional arguments passed to plotting methods |
Plot a NeuroSlice Object
The plot method uses ggplot2
to create a raster visualization of the slice data.
The intensity values are mapped to colors using the specified colormap and range.
A ggplot2
object
# Create example slice
slice_space <- NeuroSpace(c(100, 100))
slice_data <- matrix(rnorm(100*100), 100, 100)
slice <- NeuroSlice(slice_data, slice_space)
## Not run:
# Basic plot
plot(slice)
# Custom colormap
library(viridis)
plot(slice, cmap = viridis(255))
# Custom intensity range
plot(slice, irange = c(-2, 2))
## End(Not run)
dat <- matrix(rnorm(100*100), 100, 100)
slice <- NeuroSlice(dat, NeuroSpace(c(100,100)))
#plot(slice)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.