x3p_bin_stripes: Add colored stripes of the surface gradient to the mask of an...

View source: R/x3p_bin_strips.R

x3p_bin_stripesR Documentation

Add colored stripes of the surface gradient to the mask of an x3p object

Description

Apply gradient-based color shading to the mask of a 3d topographic surface. Gradients are determined empirically based on sequentical row- (or column-)wise differences of surface values. The direction parameter determines the direction of differencing. If direction is "vertical", columns in the surface matrix are differenced to identify whether 'vertical' stripes exist.

Usage

x3p_bin_stripes(
  x3p,
  direction = "vertical",
  colors = rev(c("#b12819", "#d7301f", "#e16457", "#ffffff", "#5186a2", "#175d82",
    "#134D6B")),
  freqs = c(0, 0.05, 0.1, 0.3, 0.7, 0.9, 0.95, 1)
)

Arguments

x3p

object containing a 3d topographic surface

direction

in which the stripes are created: vertical or horizontal.

colors

vector of colors

freqs

vector of values corresponding to color frequency (turned into quantiles of the differenced values)

Value

x3p object with mask colored by discretized surface gradient

Examples

data(wire)
x3p <- wire
if (interactive()) x3p_image(x3p, size = c(400, 400), zoom=0.8)
x3p_with <- x3p_bin_stripes(x3p, direction="vertical")
x3p_with <- x3p_bin_stripes(x3p, direction="vertical", 
colors=c("#b12819","#ffffff","#134D6B"), freqs=c(0, 0.3, 0.7, 1))
if (interactive()) x3p_image(x3p_with, size = c(400, 400), zoom=0.8)

data(lea)
if (interactive()) {
  lea %>% x3p_bin_stripes() %>% x3p_image() # default stripes
 
# three colors only   
  lea %>% x3p_bin_stripes(
     colors=c("#b12819","#ffffff","#134D6B"), 
     freqs=c(0, 0.3, 0.7, 1)) %>%  x3p_image()
}

x3ptools documentation built on May 29, 2024, 10:33 a.m.