# Load brain
brain <- ravecore::rave_brain("demo/DemoSubject")
# Set values with 2 variables: `ContinuousVal` and `CategoricalVal`
brain$set_electrode_values(
data.frame(
Subject = "DemoSubject",
Electrode = c(13:16, 24, 73:80),
ContinuousVal = rnorm(13),
CategoricalVal = sample(letters[1:4], size = 13, replace = TRUE),
PValue = c(0.15, 0.5, 0.9, 0.01, 0.05, 0.45, 0.8,
0.68, 0.6, 0.33, 0.001, 0.36, 0.83)
)
)
# Plot brain with options
brain$plot(
side_display = FALSE, control_display = FALSE,
# change color palettes: each variable requires a palette (if not default)
palettes = list(
# discrete values require each category to be filled with a
# color. The order is alphabetic
CategoricalVal = c("red", "blue", "green"),
# continuous values requires at least 2 key colors
ContinuousVal = c("white", "purple"),
# p-value is not linearly scaled, R provides `colorRampPalette`
# to generate non-linear color palette from at least
# 3 key colors.
# This example used 5 key colors with bias = 2 so the
PValue = colorRampPalette(
c("red", "yellow", "cyan", "gray", "gray"), bias = 2
)(100)
),
# Change value range: sets the value range for variables that have
# bounded ranges, such as p-values
value_ranges = list(
# p-value should range from 0-1
PValue = c(0, 1),
# We also want to trim the `ContinuousVal` to 95% CI
ContinuousVal = c(-2, 2)
),
# Set initial controller status
controllers = list(
# Display p-value
"Display Data" = "PValue",
# Overlay atlases from side canvas
"Voxel Type" = "aparc_aseg",
"Voxel Display" = "side camera",
# Overlay axial slices with surfaces
"Overlay Axial" = TRUE,
# Set surface opacity
"Left Opacity" = 0.4,
"Left Mesh Clipping" = 0.3,
"Right Opacity" = 0.4,
"Right Mesh Clipping" = 0.3,
# Electrode outline
"Outlines" = "on",
"Translucent" = "contact+outline",
# Background color and camera position
"Background Color" = "#000000",
"Camera Position" = "superior"
)
)