Skip to contents

Define a named scalar layer for a surface scene

Usage

surface_layer(
  name,
  values,
  indices = NULL,
  colormap = "viridis",
  limits = NULL,
  opacity = 1,
  units = NULL,
  legend = list(),
  metadata = list(),
  provenance = list(),
  visible = TRUE,
  threshold = NULL,
  role = c("map", "reference"),
  color = NULL,
  magnitude_opacity = NULL
)

Arguments

name

Stable layer name.

values

A numeric vector for a unilateral scene, or a named list with one numeric vector per hemisphere.

indices

Optional 1-based vertex indices with the same structure and lengths as values. Omit for full-vertex maps.

colormap

A surfview colormap name or a character vector of colors.

limits

Optional finite display limits. By default they are computed from finite values across hemispheres.

opacity

Numeric scalar between zero and one.

units

Optional measurement units.

legend

A list with optional title, units, visible, and metadata fields.

metadata, provenance

Arbitrary lists carried into the manifest.

visible

Whether this layer is a candidate for initial selection.

threshold

Optional static threshold pair. This preserves explicit legacy display thresholds; report mode does not add a threshold control.

role

"map" (default) or "reference". A scene requires at least one quantitative map and supports at most one binary reference. References persist below the selected map and cannot be selected as a map. Supply a full binary mask per hemisphere; indices, limits, thresholds and units are unavailable for references. Reference visibility and opacity are independent.

color

Explicit opaque reference color. A separate categorical swatch replaces the quantitative legend. Membership is linearly interpolated then classified at >= 0.5 per fragment, independently of effect values.

magnitude_opacity

Optional fade by magnitude: NULL (colours keep the colormap's alpha) or a list with optional low (magnitude below which values are transparent, default 0), high (magnitude at full opacity, or "range" for the colour-range end, the default), gamma (exponent, default 1) and floor (opacity at a positive start magnitude, default 0). A display threshold raises the start to the threshold. Viewers apply it live as the reader changes range or threshold.

Value

A validated layer specification for surface_scene.

Details

The browser renders these values as supplied. Apply inferential thresholds, tail selection, capping, and atlas projection in R. threshold preserves an explicitly authored display threshold for legacy compatibility; report mode does not add an exploratory threshold control.

Examples

surface_layer(
  "effect", c(-1.5, 0, 2),
  colormap = c("#2166ac", "#f7f7f7", "#b2182b"),
  limits = c(-2, 2), units = "z"
)
#> $name
#> [1] "effect"
#> 
#> $role
#> [1] "map"
#> 
#> $color
#> NULL
#> 
#> $values
#> [1] -1.5  0.0  2.0
#> 
#> $indices
#> NULL
#> 
#> $colormap
#> [1] "#2166ac" "#f7f7f7" "#b2182b"
#> 
#> $limits
#> [1] -2  2
#> 
#> $opacity
#> [1] 1
#> 
#> $units
#> [1] "z"
#> 
#> $legend
#> list()
#> 
#> $metadata
#> list()
#> 
#> $provenance
#> list()
#> 
#> $visible
#> [1] TRUE
#> 
#> $threshold
#> NULL
#> 
#> $magnitude_opacity
#> NULL
#> 
#> attr(,"class")
#> [1] "SurfaceLayer"